:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1a1a1a;
  --surface-active: #1f1f1f;
  --border: rgba(255,255,255,0.08);
  --border-subtle: rgba(255,255,255,0.04);
  --text: #ffffff;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-active: #0071e3;
  --accent-bg: rgba(10,132,255,0.12);
  --success: #30d158;
  --warning: #ffd60a;
  --danger: #ff453a;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 280px;
  --rail-w: 56px;
  --assets-panel-w: 264px;
  --panel-2: #1a1d27;
  --panel-2-in: #12151d;
  --topbar-h: 64px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sidebar-scroll, .ap-scroll, .asset-meta-scroll, .activity-panel-body,
.content > div[id^="view-"], .search-results, .shortcuts-body, .filter-sheet-card,
.notification-list, .upload-layout, .sync-layout, .instagram-layout,
.settings-layout, .settings-panel, .asset-preview-content { overflow-x: hidden; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* Icons */
.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: block; flex: 0 0 auto; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 28px; height: 28px; }

/* Layout */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d4a24a, #f0c46d);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: #0b0d10;
  box-shadow: 0 2px 8px rgba(212,162,74,0.3);
}
.logo-text { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.logo-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 12px; }
.nav-section { margin-bottom: 24px; }
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 0 12px;
  margin-bottom: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item .ic { width: 18px; height: 18px; opacity: 0.6; }
.nav-item.active .ic { opacity: 1; }
.nav-badge {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Folder tree */
.folder-tree { padding: 0 4px; }
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.folder-item:hover { background: var(--surface); }
.folder-item .ic { width: 16px; height: 16px; opacity: 0.5; }
.folder-count { margin-left: auto; font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 99px;
  background: var(--accent-bg);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Top bar */
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: rgba(10,10,10,0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  flex-shrink: 0;
}
.page-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.topbar-spacer { flex: 1; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 36px;
  width: 280px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.search-box input {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  outline: none;
  width: 100%;
  font-size: 14px;
}
.search-box .ic { width: 16px; height: 16px; stroke: var(--text-tertiary); }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.icon-btn .ic { width: 18px; height: 18px; }

/* Content area */
.content { 
  position: relative;
  flex: 1;
  overflow: hidden;
}
.content > div[id^="view-"] { 
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 32px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: rgba(255,255,255,0.12); }
.stat-label { font-size: 12px; color: var(--text-tertiary); font-weight: 500; letter-spacing: 0.02em; }
.stat-value { font-size: 32px; font-weight: 700; margin-top: 4px; letter-spacing: -0.03em; }
.stat-change { font-size: 13px; color: var(--success); margin-top: 4px; font-weight: 500; }

.section { margin-bottom: 40px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.section-link { font-size: 13px; color: var(--accent); cursor: pointer; font-weight: 500; }
.section-link:hover { color: var(--accent-hover); }

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.recent-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.12); box-shadow: var(--shadow-lg); }
.recent-thumb {
  aspect-ratio: 16/9;
  background: var(--surface-hover);
  background-size: cover;
  background-position: center;
}
.recent-body { padding: 14px 16px; }
.recent-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.recent-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.activity-item:hover { border-color: rgba(255,255,255,0.12); }
.activity-dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; }
.activity-dot.ok { background: var(--success); }
.activity-dot.warn { background: var(--warning); }
.activity-text { font-size: 14px; flex: 1; }
.activity-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.activity-time { font-size: 13px; color: var(--text-tertiary); flex-shrink: 0; }
.activity-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--surface-hover);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIBRARY - FOLDER FIRST
   ═══════════════════════════════════════════════════════════════════════════ */
.library-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  flex: 1;
}
.breadcrumb-item { color: var(--text-secondary); cursor: pointer; }
.breadcrumb-item:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-tertiary); }
.breadcrumb-current { font-weight: 600; color: var(--text); }

.view-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.sort-select:hover { border-color: rgba(255,255,255,0.12); }

/* Folder grid */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.folder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.folder-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.12); box-shadow: var(--shadow-md); }
.folder-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent-bg);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: var(--accent);
}
.folder-card-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.folder-card-meta { font-size: 13px; color: var(--text-tertiary); }

/* Subfolder chips */
.subfolder-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.subfolder-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.subfolder-chip:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.subfolder-chip .ic { width: 14px; height: 14px; color: var(--accent); }

/* Filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.filter-chip:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.filter-chip.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* Active filters */
.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}
.active-filter-chip .x { cursor: pointer; opacity: 0.6; font-size: 14px; }
.active-filter-chip .x:hover { opacity: 1; }
.clear-filters {
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px 10px;
}
.clear-filters:hover { color: var(--text); }

/* Bulk bar — Frame.io style bottom selection bar */
.bulk-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(24,24,27,0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.bulk-count { font-size: 13px; font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.bulk-count b { color: var(--text); font-weight: 600; }
.bulk-size { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.bulk-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
body:has(#bulk-bar:not(.hidden)) .fab { bottom: 80px; }

/* UNIFORM asset grid */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.asset-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-lg);
}
.asset-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }

/* Uniform thumb - 4:3, contain */
.asset-thumb {
  aspect-ratio: 4/3;
  background: #0a0a0a;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}
.asset-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  font-size: 32px;
}
.asset-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}
.asset-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.7);
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}
.asset-check {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 24px;
  height: 24px;
  border-radius: 99px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s;
  backdrop-filter: blur(8px);
}
.asset-card:hover .asset-check, .asset-card.selected .asset-check { opacity: 1; }
.asset-card.selected .asset-check { background: var(--accent); border-color: var(--accent); }

.asset-body { padding: 12px 14px; }
.asset-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.asset-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 3px;
}
.asset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.tag-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  padding: 12px 0;
}
.pg-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.pg-btn:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.pg-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: -0.01em;
}
.btn:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   CONTEXT MENU
   ═══════════════════════════════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  min-width: 200px;
  background: rgba(20,20,20,0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  backdrop-filter: blur(20px) saturate(180%);
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.ctx-item:hover { background: var(--surface-hover); }
.ctx-item .ic { width: 16px; height: 16px; opacity: 0.6; }
.ctx-item.danger { color: var(--danger); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }
.ctx-shortcut { margin-left: auto; font-size: 11px; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER SHEET
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-sheet {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.filter-sheet.hidden { display: none; }
.filter-sheet-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.filter-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.filter-sheet-head h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.filter-group { margin-bottom: 24px; }
.filter-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 10px;
}
.filter-options { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-option {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.filter-option:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.filter-option.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.filter-sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════════════════
   SEARCH MODAL (Spotlight-style)
   ═══════════════════════════════════════════════════════════════════════════ */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.search-modal.active {
  opacity: 1;
  pointer-events: all;
}
.search-modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
  transform: scale(0.95) translateY(-20px);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.search-modal.active .search-modal-card {
  transform: scale(1) translateY(0);
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap .ic {
  width: 22px;
  height: 22px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 17px;
  font-weight: 400;
  outline: none;
  letter-spacing: -0.02em;
}
.search-input::placeholder {
  color: var(--text-tertiary);
}
.search-kbd {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.search-filters {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.search-filters::-webkit-scrollbar { display: none; }
.search-filter-pill {
  /* now a real <button>, so it must not inherit the UA font */
  font-family: inherit;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.search-filter-pill:hover {
  background: var(--surface-hover);
  border-color: rgba(255,255,255,0.12);
}
.search-filter-pill.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}
.search-section {
  margin-bottom: 8px;
}
.search-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 8px 12px 6px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.search-result-item:hover,
.search-result-item.selected {
  background: var(--surface-hover);
}
.search-result-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  font-size: 16px;
}
.search-result-info {
  flex: 1;
  min-width: 0;
}
.search-result-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.search-result-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}
.search-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}
.search-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.4;
}
.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(20,20,20,0.5);
}
.search-footer-hint {
  font-size: 11px;
  color: var(--text-tertiary);
}
.search-footer-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 10px;
  margin: 0 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: toast-in 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.toast.success .toast-icon { background: rgba(48,209,88,0.15); color: var(--success); }
.toast.error .toast-icon { background: rgba(255,69,58,0.15); color: var(--danger); }
.toast.info .toast-icon { background: var(--accent-bg); color: var(--accent); }
.toast-content { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; }
.toast-message { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.toast-close {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background 0.15s;
}
.toast-close:hover { background: var(--surface-hover); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.shortcuts-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.shortcuts-modal.active {
  opacity: 1;
  pointer-events: all;
}
.shortcuts-card {
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.shortcuts-modal.active .shortcuts-card {
  transform: scale(1);
}
.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.shortcuts-header h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.shortcuts-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 60vh;
}
.shortcuts-section {
  margin-bottom: 24px;
}
.shortcuts-section:last-child {
  margin-bottom: 0;
}
.shortcuts-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 12px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.shortcut-label {
  font-size: 14px;
  color: var(--text);
}
.shortcut-keys {
  display: flex;
  gap: 4px;
}
.shortcut-keys kbd {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATION DROPDOWN
   ═══════════════════════════════════════════════════════════════════════════ */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.notification-dropdown.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.notification-header h4 {
  font-size: 15px;
  font-weight: 600;
}
.notification-list {
  max-height: 400px;
  overflow-y: auto;
}
.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}
.notification-item:hover {
  background: var(--surface);
}
.notification-item:last-child {
  border-bottom: 0;
}
.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.notification-icon.success { background: rgba(48,209,88,0.15); color: var(--success); }
.notification-icon.info { background: var(--accent-bg); color: var(--accent); }
.notification-icon.warn { background: rgba(255,214,10,0.15); color: var(--warning); }
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-size: 13px; font-weight: 500; }
.notification-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.notification-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.notification-footer a {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ASSET DETAIL
   ═══════════════════════════════════════════════════════════════════════════ */
#view-asset {
  padding: 0 !important;
  overflow: hidden;
}

.asset-detail-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  height: 100%;
}
.asset-preview-area {
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}
.asset-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.8);
  backdrop-filter: blur(20px);
}
.asset-preview-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.asset-preview-actions {
  display: flex;
  gap: 8px;
}
.asset-preview-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: auto;
}
.asset-preview-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(10,10,10,0.8);
  backdrop-filter: blur(20px);
}
.asset-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.asset-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.asset-metadata-sidebar {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px;
}
.metadata-section {
  margin-bottom: 28px;
}
.metadata-section:last-child {
  margin-bottom: 0;
}
.metadata-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.metadata-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
}
.asset-title-editable {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  outline: none;
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px -6px 12px;
  transition: background 0.15s;
}
.asset-title-editable:hover {
  background: var(--surface);
}
.asset-title-editable:focus {
  background: var(--surface);
}
.asset-meta-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.meta-label {
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 80px;
}
.meta-value {
  font-size: 13px;
  color: var(--text);
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tag-add-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.asset-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.comment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.comment-item {
  display: flex;
  gap: 10px;
}
.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.comment-content {
  flex: 1;
  min-width: 0;
}
.comment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.comment-author {
  font-size: 13px;
  font-weight: 600;
}
.comment-time {
  font-size: 11px;
  color: var(--text-tertiary);
}
.comment-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.comment-input-area {
  display: flex;
  gap: 8px;
}
.comment-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.comment-input:focus {
  border-color: var(--accent);
}
.version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.version-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
}
.version-item:hover {
  border-color: rgba(255,255,255,0.12);
}
.version-item.current {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.version-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--surface-hover);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.version-info {
  flex: 1;
  min-width: 0;
}
.version-name {
  font-size: 13px;
  font-weight: 500;
}
.version-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UPLOAD
   ═══════════════════════════════════════════════════════════════════════════ */
#view-upload {
  padding: 32px !important;
}

.upload-layout {
  max-width: 800px;
  margin: 0 auto;
}
.upload-header {
  margin-bottom: 32px;
}
.upload-header h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.upload-header p {
  font-size: 14px;
  color: var(--text-secondary);
}
.upload-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.upload-option-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.upload-select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.upload-select:hover {
  border-color: rgba(255,255,255,0.12);
}
.upload-select:focus {
  border-color: var(--accent);
}
.upload-properties {
  margin-bottom: 24px;
}
.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 32px;
}
.upload-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.dropzone-icon {
  width: 64px;
  height: 64px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.upload-dropzone h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.upload-dropzone p {
  font-size: 13px;
  color: var(--text-secondary);
}
.upload-dropzone .dz-touch { display: none; }
.upload-queue {
  margin-top: 32px;
}
/* Real upload rows. .upload-item below is the mockup's row; the engine
   (app.js makeRow) writes li > .name .pct .state, which had no rules at all
   and ran together as "IMG_1.MOV42%part 3 of 12". */
#upload-list li {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
#upload-list li .name  { font-weight: 500; overflow-wrap: anywhere; }
#upload-list li .pct   { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
#upload-list li .state { grid-column: 1 / -1; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
#upload-list li .state.ok  { color: var(--success); }
#upload-list li .state.err { color: var(--danger); }
#upload-list li .retry-btn { margin-left: 8px; border: 0; }
.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.upload-item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--surface-hover);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.upload-item-info {
  flex: 1;
  min-width: 0;
}
.upload-item-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-item-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.upload-progress {
  height: 4px;
  background: var(--surface-hover);
  border-radius: 99px;
  margin-top: 6px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s;
}
.upload-item-status {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}
.upload-item-status.success {
  background: rgba(48,209,88,0.15);
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}
.upload-item-status.uploading {
  background: var(--accent-bg);
  color: var(--accent);
}
.upload-item-status.pending {
  background: var(--surface-hover);
  color: var(--text-tertiary);
}

/* ══════════════════════════════════════════════════════════════════════════
   SYNC
   ═══════════════════════════════════════════════════════════════════════════ */
#view-sync {
  padding: 32px !important;
}

.sync-layout {
  max-width: 1000px;
  margin: 0 auto;
}
.sync-header {
  margin-bottom: 32px;
}
.sync-header h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.sync-header p {
  font-size: 14px;
  color: var(--text-secondary);
}
.sync-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
}
.sync-control-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sync-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.sync-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 120px;
  transition: border-color 0.15s;
}
.sync-input:focus {
  border-color: var(--accent);
}
.sync-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
.sync-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.sync-status {
  margin-bottom: 32px;
}
.sync-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  flex-shrink: 0;
}
.sync-status-dot.ok {
  background: var(--success);
}
.creators-table {
  width: 100%;
  border-collapse: collapse;
}
.creators-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.creators-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.creators-table tr:last-child td {
  border-bottom: 0;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-badge.ok {
  background: rgba(48,209,88,0.15);
  color: var(--success);
}
.status-badge.muted {
  background: var(--surface-hover);
  color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   INSTAGRAM
   ═══════════════════════════════════════════════════════════════════════════ */
#view-instagram {
  padding: 32px !important;
}

.instagram-layout {
  max-width: 900px;
  margin: 0 auto;
}
.instagram-header {
  margin-bottom: 32px;
}
.instagram-header h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.instagram-header p {
  font-size: 14px;
  color: var(--text-secondary);
}
.instagram-search {
  margin-bottom: 40px;
}
.instagram-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s;
}
.instagram-search-input-wrap:focus-within {
  border-color: var(--accent);
}
.instagram-at {
  font-size: 20px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.instagram-search-input {
  flex: 1;
  height: 40px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.instagram-search-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 8px;
}
.instagram-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.instagram-account-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s;
}
.instagram-account-item:hover {
  border-color: rgba(255,255,255,0.12);
}
.instagram-account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.instagram-account-info {
  flex: 1;
  min-width: 0;
}
.instagram-account-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.instagram-account-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.instagram-account-stats {
  display: flex;
  gap: 20px;
}
.instagram-stat {
  text-align: center;
}
.instagram-stat-value {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.instagram-stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════════════════════ */
#view-settings {
  padding: 32px !important;
}

.settings-layout {
  max-width: 1000px;
  margin: 0 auto;
}
.settings-header {
  margin-bottom: 32px;
}
.settings-header h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.settings-header p {
  font-size: 14px;
  color: var(--text-secondary);
}
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 32px;
}
.settings-tab {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.settings-tab:hover {
  color: var(--text);
}
.settings-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.settings-panel {
  display: none;
}
.settings-panel.active {
  display: block;
}
.team-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.team-member {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.team-member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.team-member-info {
  flex: 1;
  min-width: 0;
}
.team-member-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.team-member-email {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.team-member-role {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-hover);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.permissions-table {
  width: 100%;
  border-collapse: collapse;
}
.permissions-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.permissions-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.permissions-table tr:last-child td {
  border-bottom: 0;
}
.permissions-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.category-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.category-color {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  flex-shrink: 0;
}
.category-info {
  flex: 1;
  min-width: 0;
}
.category-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.category-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.category-type {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-hover);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.saved-views-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.saved-view-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.saved-view-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.saved-view-info {
  flex: 1;
  min-width: 0;
}
.saved-view-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.saved-view-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.saved-view-pinned {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING ACTION BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(10,132,255,0.4);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  z-index: 50;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(10,132,255,0.5);
  background: var(--accent-hover);
}
.fab:active {
  transform: scale(0.95);
}
.fab .ic {
  width: 24px;
  height: 24px;
}
.fab-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.fab-menu.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.fab-menu-item:hover {
  background: var(--surface);
}
.fab-menu-item .ic {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARD HOVER ACTIONS (play / download / publish)
   ═══════════════════════════════════════════════════════════════════════════ */
.asset-actions {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 3;
}
.asset-card:hover .asset-actions { opacity: 1; }
.asset-act {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.asset-act:hover { background: rgba(10,132,255,0.85); border-color: transparent; }
.asset-act .ic { width: 14px; height: 14px; }
.asset-act.pub-on { color: var(--success); }
.asset-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 48px;
  height: 48px;
  border-radius: 99px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
  z-index: 2;
}
.asset-card:hover .asset-play { opacity: 1; transform: scale(1); }
.asset-play:hover { background: rgba(10,132,255,0.85); }
.asset-play .ic { width: 20px; height: 20px; fill: currentColor; stroke: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   QUICK LOOK OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */
.quicklook {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.quicklook.active { opacity: 1; pointer-events: all; }
.ql-back {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
}
.ql-card {
  position: relative;
  width: min(1000px, 92vw);
  max-height: 88vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.quicklook.active .ql-card { transform: scale(1) translateY(0); }
.ql-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.ql-titles { flex: 1; min-width: 0; }
.ql-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ql-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.ql-pos { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ql-head-actions { display: flex; align-items: center; gap: 8px; }
.ql-body {
  flex: 1;
  display: grid;
  place-items: center;
  background: #000;
  min-height: 360px;
  overflow: hidden;
}
.ql-body img { max-width: 100%; max-height: 60vh; display: block; }
.ql-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.ql-hint { font-size: 11px; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════════════════
   ANCHORED POPOVERS (download sizes / publish slots)
   ═══════════════════════════════════════════════════════════════════════════ */
.popover {
  position: fixed;
  z-index: 260;
  width: 288px;
  background: rgba(28,28,30,0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  padding: 8px;
  animation: pop-in 0.16s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
}
.pop-title { font-size: 13px; font-weight: 600; }
.pop-sub { font-size: 11px; color: var(--text-tertiary); }
.pop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
  color: var(--text);
}
.pop-row:hover { background: var(--surface-hover); }
.pop-row .grow { flex: 1; min-width: 0; }
.pop-row .size { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.pop-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pop-foot { padding: 8px 10px 4px; font-size: 11px; color: var(--text-tertiary); }
.pub-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.pub-row:hover { background: var(--surface-hover); }
.pub-row input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.pub-row-text { flex: 1; min-width: 0; }
.pub-row b { font-size: 13px; font-weight: 600; display: block; }
.pub-hint { font-size: 11px; color: var(--text-tertiary); display: block; margin-top: 1px; line-height: 1.35; }
.pub-row.at-cap .pub-hint { color: var(--warning); }
.pub-flag { font-size: 10px; font-weight: 700; color: var(--success); letter-spacing: 0.04em; padding-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER BAR (persistent, above the grid)
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.fbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.seg-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface-active); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.seg-btn .ic { width: 14px; height: 14px; }
.fbar-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.fbar-select:hover { border-color: rgba(255,255,255,0.12); }
.fbar-custom { display: flex; align-items: center; gap: 8px; }
.fbar-custom span { font-size: 12px; color: var(--text-tertiary); }
.fbar-custom input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12.5px;
  color-scheme: dark;
  outline: none;
}
.fbar-custom input:focus { border-color: var(--accent); }
.fbar-active { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fbar-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   SAVED VIEWS PILL RAIL + TAG CLOUD
   ═══════════════════════════════════════════════════════════════════════════ */
.views-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.views-rail::-webkit-scrollbar { display: none; }
.view-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.view-pill:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); }
.view-pill.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.view-pill .ic { width: 13px; height: 13px; color: var(--accent); }
.view-pill.add { color: var(--text-tertiary); border-style: dashed; }
.view-pill.add:hover { color: var(--text); }
.rail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  white-space: nowrap;
  margin-right: 2px;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px; }
.tag-cloud-chip {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.tag-cloud-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-cloud-chip b { color: var(--text-tertiary); font-weight: 600; margin-left: 3px; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOLDER MOSAIC COVERS
   ═══════════════════════════════════════════════════════════════════════════ */
.folder-card-cover {
  aspect-ratio: 16/9;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  background: #0a0a0a;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
}
.fmos { display: block; width: 100%; height: 100%; object-fit: cover;
        background-size: cover; background-position: center; background-color: var(--surface-hover); }
.folder-card-cover.n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.folder-card-cover.empty { place-items: center; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════════════════
   BULK BAR + SHEETS
   ═══════════════════════════════════════════════════════════════════════════ */
.sheet-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin: 18px 0 8px;
}
.sheet-label:first-of-type { margin-top: 0; }
.sheet-hint { font-size: 12.5px; color: var(--text-tertiary); line-height: 1.45; margin-bottom: 10px; }
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin: 10px 0;
}
.inline-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.sheet-field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.sheet-field:focus { border-color: var(--accent); }
select.sheet-field { cursor: pointer; }
.sheet-row { display: flex; gap: 8px; align-items: center; }
.sheet-row .sheet-field { flex: 1; }
.btn.danger { background: rgba(255,69,58,0.12); color: var(--danger); border-color: rgba(255,69,58,0.25); }
.btn.danger:hover { background: rgba(255,69,58,0.2); border-color: rgba(255,69,58,0.4); }
.dl-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  margin: 12px 0;
}
.dl-sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
}
.dl-sheet-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-sheet-row .picked { color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-summary {
  display: flex;
  justify-content: space-between;
  padding: 12px 2px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.dl-summary b { font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════════════
   LIST VIEW + MINIMAL + SENTINEL
   ═══════════════════════════════════════════════════════════════════════════ */
.asset-grid.list-view { display: flex; flex-direction: column; gap: 8px; }
.asset-grid.list-view .asset-card { display: flex; align-items: stretch; }
.asset-grid.list-view .asset-card:hover { transform: none; }
.asset-grid.list-view .asset-thumb { width: 104px; aspect-ratio: 16/10; flex-shrink: 0; }
.asset-grid.list-view .asset-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  min-width: 0;
}
.asset-grid.list-view .asset-title { flex: 1; }
.asset-grid.list-view .asset-tags { margin-top: 0; }
.asset-grid.list-view .asset-meta { margin-top: 0; white-space: nowrap; }
.asset-grid.list-view .asset-play, .asset-grid.list-view .asset-actions { display: none; }
.asset-grid.list-view .asset-duration { right: 4px; bottom: 4px; font-size: 9px; padding: 2px 4px; }
.asset-grid.list-view .asset-badge { left: 4px; top: 4px; font-size: 8px; padding: 2px 5px; }
.asset-grid.minimal .asset-tags, .asset-grid.minimal .asset-meta { display: none; }
.asset-grid.minimal .asset-body { padding: 10px 14px; }
.scroll-sentinel {
  margin-top: 24px;
  padding: 16px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.scroll-sentinel:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.cols-wrap { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.cols-wrap .ic { width: 14px; height: 14px; color: var(--text-tertiary); }
.cols-wrap input[type="range"] { width: 84px; accent-color: var(--accent); cursor: pointer; }
.cols-val { font-size: 11px; color: var(--text-tertiary); min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.btn.toggle-on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVITY DRAWER
   ═══════════════════════════════════════════════════════════════════════════ */
.activity-drawer { position: fixed; inset: 0; z-index: 290; pointer-events: none; }
.activity-drawer.active { pointer-events: all; }
.activity-back { position: absolute; inset: 0; background: rgba(0,0,0,0.4); opacity: 0; transition: opacity 0.25s; }
.activity-drawer.active .activity-back { opacity: 1; }
.activity-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.activity-drawer.active .activity-panel { transform: translateX(0); }
.activity-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.activity-panel-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; flex: 1; }
.activity-panel-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.activity-panel-foot { padding: 12px 20px; border-top: 1px solid var(--border); text-align: center; }
.activity-panel-foot a { font-size: 13px; font-weight: 500; cursor: pointer; }
.run-group { margin-bottom: 14px; }
.run-item {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
  cursor: pointer;
}
.run-item:hover { border-color: rgba(255,255,255,0.12); }
.run-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.run-title { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-time { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }
.run-meta { font-size: 12px; color: var(--text-tertiary); }
.run-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.run-thumb {
  aspect-ratio: 4/3;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-hover);
}
.run-more { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }
.bell-wrap { position: relative; }
.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ASSET DETAIL — NOTION PROPERTIES / LINKS / SAVE BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.asset-metadata-sidebar { display: flex; flex-direction: column; padding: 0; }
.asset-meta-scroll { flex: 1; overflow-y: auto; padding: 24px; min-height: 0; }
.asset-save-bar {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.asset-sub-line { font-size: 12px; color: var(--text-tertiary); margin: -6px 0 16px; padding: 0 6px; }
.props { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.prop-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 40px;
  transition: background 0.12s;
}
.prop-row:last-child { border-bottom: 0; }
.prop-row:hover { background: var(--surface-hover); }
.prop-key {
  width: 78px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 3px;
}
.prop-key .ic { width: 13px; height: 13px; opacity: 0.7; }
.prop-val { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.prop-chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.prop-chip:hover { border-color: rgba(255,255,255,0.22); color: var(--text); }
.prop-chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.src-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.src-row:last-child { border-bottom: 0; }
.src-key {
  width: 56px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.src-val {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.copy-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.copy-btn .ic { width: 13px; height: 13px; }
.display-title-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.display-title-input:focus { border-color: var(--accent); }
.display-title-input::placeholder { color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════════════════
   CATEGORY EDITOR
   ═══════════════════════════════════════════════════════════════════════════ */
.cat-color-input {
  width: 52px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.options-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.option-drag { color: var(--text-tertiary); cursor: grab; display: grid; place-items: center; flex-shrink: 0; }
.option-drag .ic { width: 14px; height: 14px; }
.option-color {
  width: 26px;
  height: 26px;
  padding: 1px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  cursor: pointer;
  flex-shrink: 0;
}
.option-label { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-del {
  color: var(--text-tertiary);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.option-del:hover { color: var(--danger); background: rgba(255,69,58,0.1); }
.option-del .ic { width: 13px; height: 13px; }

/* ═══════════════════════════════════════════════════════════════════════════
   INSTAGRAM PROFILE RESULT
   ═══════════════════════════════════════════════════════════════════════════ */
.ig-result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 40px;
}
.ig-profile { display: flex; gap: 20px; align-items: flex-start; }
.ig-avatar {
  width: 84px;
  height: 84px;
  border-radius: 99px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-hover);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.12);
}
.ig-profile-main { flex: 1; min-width: 0; }
.ig-name { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.ig-verified {
  width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.ig-verified .ic { width: 10px; height: 10px; stroke-width: 3; }
.ig-handle { font-size: 13px; color: var(--text-tertiary); margin-top: 2px; }
.ig-stats { font-size: 13px; color: var(--text-secondary); margin-top: 8px; }
.ig-stats b { color: var(--text); font-weight: 600; }
.ig-bio { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; max-width: 560px; }
.ig-found-pill {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(48,209,88,0.15);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.ig-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 20px; }
.ig-post {
  aspect-ratio: 1;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-hover);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
}
.ig-post:hover { border-color: rgba(255,255,255,0.2); }
.ig-post-kind {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  color: #fff;
}
.ig-assign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.ig-assign-field { display: flex; flex-direction: column; gap: 6px; }
.ig-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.ig-actions-note { font-size: 12px; color: var(--text-tertiary); }

/* ═══════════════════════════════════════════════════════════════════════════
   UPLOAD — NOTE / RETRY / MULTIPART
   ═══════════════════════════════════════════════════════════════════════════ */
.upload-text-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.upload-text-input:focus { border-color: var(--accent); }
.upload-text-input::placeholder { color: var(--text-tertiary); }
.upload-item-status.failed {
  background: rgba(255,69,58,0.15);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 6px;
}
.retry-btn {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255,69,58,0.2);
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.retry-btn:hover { background: rgba(255,69,58,0.32); }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .assets-panel { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ live-data additions ═══ */
.demo-pill {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(255,214,10,0.15);
  color: var(--warning);
  font-weight: 600;
  margin-left: 10px;
  vertical-align: middle;
}
.thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-glyph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-tertiary); font-size: 28px; }
.recent-thumb img, .activity-thumb img, .run-thumb img, .search-result-thumb img, .version-thumb img, .upload-item-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}
.recent-thumb, .activity-thumb, .run-thumb { position: relative; overflow: hidden; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--text-tertiary); font-size: 14px; grid-column: 1 / -1; }
.empty-icon { font-size: 28px; margin-bottom: 8px; opacity: 0.6; }
.empty-inline { color: var(--text-tertiary); font-size: 13px; padding: 8px 12px; }
.muted-note { color: var(--text-tertiary); font-size: 13px; }
.pager-meta { font-size: 12.5px; color: var(--text-tertiary); margin-right: 12px; font-variant-numeric: tabular-nums; }
.tag-cloud-chip.active { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   RECENT PAGE — long activity feed
   ═══════════════════════════════════════════════════════════════════════════ */
.recent-page { max-width: 860px; margin: 0 auto; padding: 28px 32px 80px; }
.recent-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.recent-h { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.recent-sub { font-size: 12.5px; color: var(--text-tertiary); margin-top: 3px; }
.recent-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.rpill {
  height: 30px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 550; color: var(--text-secondary);
  transition: background .14s, border-color .14s, color .14s;
}
.rpill:hover { background: var(--surface-hover); color: var(--text); }
.rpill.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.recent-searches { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.rs-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-right: 4px; }
.rs-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary);
}
.rs-chip:hover { border-color: rgba(255,255,255,.14); color: var(--text); }
.rs-x { opacity: .5; } .rs-chip:hover .rs-x { opacity: 1; }
.rs-clear { font-size: 11.5px; color: var(--text-tertiary); margin-left: 4px; }
.rs-clear:hover { color: var(--text); }
.recent-strip-wrap { margin-bottom: 26px; }
.recent-strip-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.recent-strip-hint { font-size: 11.5px; color: var(--text-tertiary); }
.recent-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.recent-strip .strip-card {
  flex: 0 0 168px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: transform .16s, border-color .16s;
}
.recent-strip .strip-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.14); }
.strip-thumb { aspect-ratio: 16/10; background: #0f131b center/contain no-repeat; position: relative; }
.strip-thumb .thumb-glyph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-tertiary); font-size: 20px; }
.strip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip-body { padding: 8px 10px; }
.strip-title { font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-meta { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }

.feed-day {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px; margin: 18px 0 8px;
  background: linear-gradient(180deg, var(--bg) 78%, transparent);
  font-size: 12px; font-weight: 650; color: var(--text-secondary);
  letter-spacing: .02em;
}
.feed-day:first-child { margin-top: 0; }
.feed-day .fd-count { font-weight: 500; color: var(--text-tertiary); font-size: 11px; }
.feed-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.fgroup {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 8px;
  transition: border-color .14s;
}
.fgroup:hover { border-color: rgba(255,255,255,.13); }
.fgroup-head { display: flex; align-items: center; gap: 10px; }
.fgroup-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
}
.fgroup-ico.sync { background: var(--accent-bg); color: var(--accent); }
.fgroup-ico.upload { background: rgba(48,209,88,.14); color: var(--success); }
.fgroup-ico.instagram { background: rgba(201,79,153,.15); color: #e07ab8; }
.fgroup-ico.youtube { background: rgba(255,69,58,.13); color: #ff6b61; }
.fgroup-ico.edit { background: rgba(255,214,10,.12); color: var(--warning); }
.fgroup-ico .ic { width: 16px; height: 16px; }
.fgroup-titles { flex: 1; min-width: 0; }
.fgroup-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgroup-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 1px; }
.fgroup-meta .ok { color: var(--success); font-weight: 600; }
.fgroup-meta .warn { color: var(--danger); font-weight: 600; }
.fgroup-time { font-size: 11.5px; color: var(--text-tertiary); flex-shrink: 0; }
.fgroup-thumbs { display: flex; gap: 6px; margin-top: 10px; }
.fgroup-thumbs .fgt {
  width: 52px; height: 52px; border-radius: 8px; overflow: hidden; position: relative;
  background: #0f131b; flex-shrink: 0; cursor: pointer; border: 1px solid var(--border-subtle);
}
.fgroup-thumbs .fgt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fgroup-thumbs .fgt .thumb-glyph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: var(--text-tertiary); }
.fgroup-thumbs .fgt-more {
  display: grid; place-items: center; background: var(--surface-hover);
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer;
}
.fgroup-thumbs .fgt-more:hover { color: var(--text); }
.fgroup-expanded .fgroup-thumbs {
  flex-wrap: wrap;
}
.fgroup-expanded .fgroup-thumbs .fgt { width: 64px; height: 64px; }
.fgroup-note { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }

.feed-sentinel {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 0 8px; font-size: 12.5px; color: var(--text-tertiary);
}
.feed-sentinel .spin {
  width: 14px; height: 14px; border-radius: 99px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: fspin .7s linear infinite;
}
@keyframes fspin { to { transform: rotate(360deg); } }

.back-to-top {
  position: fixed; right: 28px; bottom: 84px; z-index: 60;
  width: 40px; height: 40px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-secondary);
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; transform: translateY(8px);
}
.back-to-top.show { opacity: 1; pointer-events: all; transform: none; }
.back-to-top:hover { color: var(--text); border-color: rgba(255,255,255,.16); }
.back-to-top .ic { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════════════════════════════════════
   FRAME.IO RESTYLE — icon rail, assets panel, folder cards, toolbar, share
   ═══════════════════════════════════════════════════════════════════════════ */
.main { position: relative; }

/* ── Far-left icon rail ── */
.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 12px;
  overflow: visible;
}
.rail-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #d4a24a, #f0c46d);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 10px;
  color: #0b0d10;
  box-shadow: 0 2px 8px rgba(212,162,74,0.3);
  margin-bottom: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.rail-nav { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rail .nav-item, .rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text-tertiary);
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.rail .nav-item .ic, .rail-btn .ic { width: 19px; height: 19px; opacity: 1; }
.rail .nav-item:hover, .rail-btn:hover { background: var(--surface); color: var(--text); }
.rail .nav-item.active { background: var(--accent-bg); color: var(--accent); }
.rail .nav-item::after, .rail-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #26262b;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 220;
  box-shadow: var(--shadow-md);
}
.rail .nav-item:hover::after, .rail-btn:hover::after { opacity: 1; }
.rail .bell-wrap { display: grid; place-items: center; }
.rail .bell-badge { top: -2px; right: -2px; border-color: var(--bg-elevated); }
.rail-avatar {
  width: 32px;
  height: 32px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid rgba(10,132,255,0.35);
}

/* ── Second panel: Assets (Library only) ── */
.assets-panel {
  width: var(--assets-panel-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.assets-panel.hidden { display: none; }
.ap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ap-add {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  transition: background 0.15s, color 0.15s;
}
.ap-add:hover { background: var(--surface); color: var(--text); }
.ap-add .ic { width: 14px; height: 14px; }
.ap-scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; min-height: 0; }
.ap-divider { height: 1px; background: var(--border); margin: 10px 4px; flex-shrink: 0; }
.ap-sec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 4px 8px 6px;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.tree-row:hover { background: var(--surface); color: var(--text); }
.tree-row.active { background: var(--surface-active); color: var(--text); }
.tree-row .ic { width: 15px; height: 15px; opacity: 0.65; flex-shrink: 0; }
.tree-row.muted { color: var(--text-tertiary); }
.tree-row.muted .ic { opacity: 0.4; }
.tree-row.add { color: var(--text-tertiary); font-size: 12.5px; }
.tree-row.add:hover { color: var(--text); }
.tree-caret {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.15s;
  border-radius: 4px;
}
.tree-caret:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.tree-caret.open { transform: rotate(90deg); }
.tree-caret.none { visibility: hidden; }
.tree-caret .ic { width: 11px; height: 11px; opacity: 1; }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-count { font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tree-emoji { width: 18px; text-align: center; flex-shrink: 0; font-size: 13px; }
.ap-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ap-foot-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--success); flex-shrink: 0; }
.ap-tags { padding: 2px 8px 6px; }
.ap-tags .tag-cloud { padding: 0; }

/* ── Frame.io-style folder cards ── */
.fcard {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.fcard::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 12px;
  width: 40%;
  height: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
}
.fcard:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.14); box-shadow: var(--shadow-md); }
.fcard:hover::before { border-color: rgba(255,255,255,0.14); }
.fcard.selected, .fcard.checked { border-color: var(--accent); }
.fcard-thumb {
  position: relative;
  aspect-ratio: 16/10;
  margin: 10px 10px 0;
  border-radius: 8px;
  background: var(--panel-2-in);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.fcard-thumb .folder-card-cover {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}
.fcard-thumb .folder-card-cover.empty { background: transparent; color: var(--text-tertiary); }
.fcard-check {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 22px;
  height: 22px;
  border-radius: 99px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 3;
  backdrop-filter: blur(8px);
}
.fcard:hover .fcard-check { opacity: 1; }
.fcard.checked .fcard-check { opacity: 1; background: var(--accent); border-color: var(--accent); }
.fcard-body { padding: 10px 12px 12px; }
.fcard-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.fcard-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-tertiary); }
.fcard-menu {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.fcard:hover .fcard-menu { opacity: 1; }
.fcard-menu:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.fcard-menu .ic { width: 14px; height: 14px; }
.fcard.sm { width: 180px; flex: 0 0 auto; margin-top: 10px; }
.fcard.sm .fcard-name { font-size: 13px; }
.subfolder-row { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; align-items: flex-end; }
.files-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  color: var(--text-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.files-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Toolbar text buttons + dropdowns ── */
.tbar-left { display: flex; align-items: center; gap: 4px; }
.tbtn-wrap { position: relative; }
.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.tbtn:hover { background: var(--surface); color: var(--text); }
.tbtn .ic { width: 15px; height: 15px; }
.tdrop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 248px;
  background: rgba(28,28,31,0.97);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(180%);
  padding: 12px;
  z-index: 120;
  display: none;
}
.tdrop.active { display: block; animation: pop-in 0.16s cubic-bezier(0.32, 0.72, 0, 1); }
.tdrop-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin: 10px 0 6px;
}
.tdrop-label:first-child { margin-top: 0; }
.tdrop .seg { display: flex; }
.tdrop .seg .seg-btn { flex: 1; justify-content: center; }
.tdrop .cols-wrap { width: 100%; display: flex; background: var(--bg-elevated); }
.tdrop .cols-wrap input[type="range"] { flex: 1; }
.tdrop-min-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
.field-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
}
.field-check:hover { background: var(--surface-hover); color: var(--text); }
.field-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
}
.sort-wrap .ic { width: 14px; height: 14px; opacity: 0.7; }
.sort-wrap select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  height: 100%;
}
.sort-wrap select option { background: var(--surface); color: var(--text); }

/* Field visibility toggles on the grid */
.asset-meta .am-date:not(:last-child)::after { content: ' · '; }
.asset-grid.hide-date .am-date { display: none; }
.asset-grid.hide-size .am-size { display: none; }
.asset-grid.hide-tags .asset-tags { display: none; }
.asset-grid.hide-badge .asset-badge { display: none; }

/* ── Top bar breadcrumbs (Frame.io style) ── */
#page-title { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; flex-shrink: 1; overflow: visible; }
.crumb {
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  position: relative;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb:hover { color: var(--text); }
.crumb.cur { color: var(--text); font-weight: 600; cursor: default; }
.crumb-caret {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.crumb-caret:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.crumb-caret .ic { width: 12px; height: 12px; }
.crumb-drop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  background: rgba(28,28,31,0.97);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(180%);
  padding: 6px;
  z-index: 180;
}
.crumb-drop-row {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.crumb-drop-row:hover { background: var(--surface-hover); color: var(--text); }
.crumb-drop-row .ic { width: 14px; height: 14px; opacity: 0.6; flex-shrink: 0; }

/* ── Share panel (right slide-in) ── */
.share-drawer { position: fixed; inset: 0; z-index: 295; pointer-events: none; }
.share-drawer.active { pointer-events: all; }
.share-back { position: absolute; inset: 0; background: rgba(0,0,0,0.4); opacity: 0; transition: opacity 0.25s; }
.share-drawer.active .share-back { opacity: 1; }
.share-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 92vw;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.share-drawer.active .share-panel { transform: translateX(0); }
.share-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.share-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.share-target {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-body { flex: 1; overflow-y: auto; padding: 8px 20px 20px; }
.sp-sec {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin: 20px 0 10px;
}
.sp-sec:first-child { margin-top: 12px; }
.sp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
}
.sp-label { flex: 1; min-width: 0; color: var(--text); }
.sp-muted { color: var(--text-tertiary); font-size: 12.5px; }
.sp-linkrow { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }
.sp-url {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
}
.sp-url:focus { border-color: var(--accent); }
.sp-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}
.sp-select:focus { border-color: var(--accent); }
.sp-avatars { display: flex; }
.sp-av {
  width: 28px;
  height: 28px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid var(--bg-elevated);
  margin-left: -8px;
}
.sp-av:first-child { margin-left: 0; }
.sp-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.sp-chip:hover { border-color: var(--accent); color: var(--accent); }
.share-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.share-foot .btn { justify-content: center; }

/* iOS-style switch */
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--surface-active);
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}
.switch i::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { left: 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   PHASE 2 — ENGINE BRIDGE
   Rules for elements the production engine emits that the new design did not
   already have a class for. Everything here uses the design's own tokens.
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- uniform cards -------------------------------------------------------
   The thumb is a fixed 4:3 box and the body is a fixed three-line stack, so
   every card in the grid is exactly the same height. Tags are clipped to one
   line rather than wrapping, which is the only thing that could still change
   a card's height. */
.asset-grid:not(.list-view) .asset-tags {
  flex-wrap: nowrap;
  overflow: hidden;
  height: 18px;
}
.asset-grid:not(.list-view) .asset-title,
.asset-grid:not(.list-view) .asset-meta { height: 19px; }
.asset-grid:not(.list-view) .asset-meta { overflow: hidden; white-space: nowrap; }
.asset-grid.cols-fixed { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.asset-card.sel-focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.asset-thumb .thumb-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.asset-thumb .thumb-glyph { position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-tertiary); font-size: 32px; }
.asset-actions .dl-btn[disabled] { opacity: 0.35; cursor: default; }
.marquee { position: fixed; z-index: 900; border: 1px solid var(--accent);
  background: var(--accent-bg); pointer-events: none; border-radius: 4px; }
body.marquee-on { user-select: none; }

/* --- filter bar ---------------------------------------------------------- */
#filter-bar { display: flex; flex-direction: column; gap: 8px; }
.fb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-field { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.fb-select {
  height: 32px; padding: 0 8px; border-radius: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-size: 12px;
}
.fb-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-active { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fb-active:empty { display: none; }
.fb-chip .x { cursor: pointer; color: var(--text-tertiary); margin-left: 2px; }
.fb-chip .x:hover { color: var(--danger); }

/* --- shared form + text helpers ------------------------------------------ */
.input {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-size: 13px;
}
.input:focus { outline: none; border-color: var(--accent); }
.muted, .muted-note { color: var(--text-tertiary); font-size: 12px; }
.empty-inline { color: var(--text-tertiary); font-size: 13px; padding: 20px; text-align: center; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); font-weight: 600; }
.right { text-align: right; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.pg-btn.danger { color: var(--danger); }
.pg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --- pager / sentinel ---------------------------------------------------- */
.sentinel-msg { color: var(--text-tertiary); font-size: 12px; margin-right: 10px; }
.sentinel-msg.err { color: var(--danger); }
.sentinel-spin {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: ct-spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes ct-spin { to { transform: rotate(360deg); } }
#lib-sentinel { display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 18px 0; }

/* --- folder tree --------------------------------------------------------- */
.folder-kids { display: block; }
.tree-caret.none { visibility: hidden; }
.tree-menu {
  color: var(--text-tertiary); opacity: 0; padding: 0 4px; flex: 0 0 auto;
}
.tree-row:hover .tree-menu { opacity: 1; }
.tree-menu:hover { color: var(--text); }

/* --- folder gallery ------------------------------------------------------ */
.fg-crumbs { margin-bottom: 12px; }

/* --- asset detail sidebar ------------------------------------------------ */
.meta-section { margin-top: 20px; }
.meta-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); font-weight: 600; margin-bottom: 8px;
}
.props-panel { display: flex; flex-direction: column; gap: 10px; }
.asset-page-save-bar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }
.src-row .src-val a { word-break: break-all; }

/* --- settings: categories + saved views ---------------------------------- */
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 8px; list-style: none;
}
.cat-info { flex: 1; min-width: 0; }
.cat-label { font-size: 13px; font-weight: 600; }
.cat-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pin { color: var(--warning); flex: 0 0 auto; }
.pin.off { color: var(--text-tertiary); }
#views-admin-list { list-style: none; padding: 0; margin: 0; }

/* --- creators + jobs ----------------------------------------------------- */
.ct-name { font-size: 13px; font-weight: 600; }
.scan-btns { display: inline-flex; gap: 6px; }
#jobs-list { list-style: none; padding: 0; margin: 0; }
#jobs-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
#jobs-list .id { color: var(--text-tertiary); font-family: ui-monospace, monospace; }

/* --- instagram ----------------------------------------------------------- */
.ig-acct, .ig-job {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px;
}
.ig-acct-avatar, .ig-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: var(--surface-hover) center/cover no-repeat;
}
.ig-acct-main { flex: 1; min-width: 0; }
.ig-acct-name { font-size: 13px; font-weight: 600; }
.ig-acct-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ig-warn { color: var(--warning); }
.ig-job-status { font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-hover); text-transform: uppercase; letter-spacing: 0.04em; }
.ig-job-status.error { color: var(--danger); }
.ig-job-status.done { color: var(--success); }
.ig-job-handle { font-weight: 600; font-size: 13px; }
.ig-job-detail { flex: 1; min-width: 0; }
.ig-bar { height: 4px; border-radius: 4px; background: var(--surface-hover);
  overflow: hidden; margin-top: 6px; }
.ig-bar-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
.ig-bar-fill.indeterminate { animation: ct-pulse 1.2s ease-in-out infinite; }
@keyframes ct-pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }
.ig-bar-text { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.ig-profile { display: flex; align-items: center; gap: 14px; }
.ig-profile-main { flex: 1; min-width: 0; }
.ig-profile-name { font-size: 15px; font-weight: 600; }
.ig-found-pill { font-size: 11px; padding: 4px 10px; border-radius: 99px;
  background: rgba(48,209,88,0.15); color: var(--success); flex: 0 0 auto; }
.ig-preview-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.ig-prev { position: relative; width: 84px; height: 84px; flex: 0 0 auto;
  border-radius: 8px; overflow: hidden; background: var(--surface-hover); }
.ig-prev img { width: 100%; height: 100%; object-fit: cover; }
.ig-prev-kind { position: absolute; left: 4px; bottom: 4px; font-size: 9px;
  padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,0.7); }
.ig-miss { padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); }

/* --- activity feed (bell drawer + sync page) ----------------------------- */
.activity-run { margin-bottom: 10px; }
.run-thumb { position: relative; overflow: hidden; }
.run-thumb-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px;
  font-size: 9px; line-height: 1.2; background: rgba(0,0,0,0.65);
  color: rgba(255,255,255,0.9); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-align: left;
}
.run-thumb.thumb-failed .fallback { display: grid; }
.run-meta .errors.has { color: var(--danger); }
.run-meta .added { color: var(--success); }
.activity-foot { display: flex; justify-content: center; padding: 10px 0; }
.activity-loading, .activity-end, .activity-error { color: var(--text-tertiary); font-size: 12px; }
.activity-error { color: var(--danger); display: flex; gap: 8px; align-items: center; }
.activity-empty { text-align: center; color: var(--text-tertiary); padding: 30px 10px; }
.activity-offline { font-size: 12px; color: var(--warning); padding: 6px 10px;
  background: rgba(255,214,10,0.1); border-radius: 8px; margin-bottom: 10px; }
.activity-skeleton .sk-run { padding: 12px; margin-bottom: 8px; border-radius: var(--radius);
  background: var(--surface); }
.sk-line { height: 10px; border-radius: 4px; background: var(--surface-hover); margin-bottom: 8px; }
.sk-line.short { width: 45%; }
.sk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sk-tile { aspect-ratio: 1; border-radius: 6px; background: var(--surface-hover); }

/* The floating "+" button sits over the bottom-right of the viewport, so the
   asset sidebar's save bar needs room to clear it. */
.asset-page-save-bar { padding-bottom: 56px; }

/* A sync run can carry any number of previews (the engine shows all of them,
   up to 24 before the "Show all" toggle), so the 4-column grid the design used
   for a fixed sample becomes a wrapping row of fixed-size thumbs. */
.activity-run .run-thumbs {
  display: flex; flex-wrap: wrap; gap: 6px;
  grid-template-columns: none;
}
.activity-run .run-thumb { width: 74px; aspect-ratio: 4/3; flex: 0 0 auto; padding: 0; }
.activity-run .run-thumb .thumb-glyph { font-size: 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   UNPLAYABLE MEDIA SURFACE  (Phase 3 / video-playback fix)

   Emitted by the engine's unplayableHtml(). Five class names, re-authored here
   to the new design's tokens: the card is a surface panel, not a black box, and
   it always carries the two things that still work — the source link and the
   download route.
   ═══════════════════════════════════════════════════════════════════════════ */
.media-unplayable {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.media-unplayable .unplayable-poster {
  max-width: 100%;
  max-height: 34vh;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  display: block;
  object-fit: contain;
}
.media-unplayable-body { width: 100%; }
.media-unplayable-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 8px;
}
.media-unplayable-why {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 auto 16px;
  max-width: 46ch;
}
.media-unplayable-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIBRARY HEAD — pager placement fix

   .lib-head had no rule at all, so its four children (title, meta, chips,
   pager) stacked as blocks and #lib-pager-top landed as a full-width row
   immediately above the "Files in this folder" divider. It belongs on the
   title's own line, pushed right.
   ═══════════════════════════════════════════════════════════════════════════ */
.lib-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.lib-head #lib-title { flex: 0 0 auto; }
.lib-head .pager-meta { margin-right: 0; }
.lib-head .fbar-active { flex: 1 1 auto; min-width: 0; }
.lib-head #lib-pager-top {
  margin: 0 0 0 auto;
  padding: 0;
  flex: 0 0 auto;
  justify-content: flex-end;
}
.lib-head #lib-pager-top:empty { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD + RECENT (Phase 3) — additions to the mockup's own styles
   ═══════════════════════════════════════════════════════════════════════════ */
#view-dashboard { padding: 28px 32px 60px; }
.stat-card .stat-value.loading { color: var(--text-tertiary); }
/* .stat-source removed: the endpoint is now a data-source/title attribute on
   .stat-card, inspectable but not printed on screen. */
.dash-error {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.recent-card { cursor: pointer; }
.recent-card .recent-thumb { position: relative; background-size: cover; background-position: center; }

/* Recent view: states the engine's feed controller emits, styled to the design */
.feed .feed-empty,
.feed .feed-error,
.feed .feed-end {
  padding: 22px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
}
.feed .feed-error { border-color: rgba(255,69,58,0.35); }
.feed .feed-empty .btn, .feed .feed-error .btn { margin-top: 12px; }
.feed-offline {
  padding: 9px 13px;
  border-radius: 9px;
  background: rgba(255,214,10,0.10);
  border: 1px solid rgba(255,214,10,0.3);
  color: var(--warning);
  font-size: 12.5px;
  margin-bottom: 14px;
}
.feed-skeleton .sk-card {
  height: 78px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: feedsk 1.3s ease infinite;
  margin-bottom: 8px;
}
@keyframes feedsk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
#feed-sentinel .btn { pointer-events: all; }
.rpill[disabled] { opacity: .38; cursor: not-allowed; }
.rpill[disabled]:hover { background: var(--surface); color: var(--text-secondary); }
.fgroup-thumbs { flex-wrap: wrap; }
#view-recent { padding: 0; }
.recent-page { padding: 28px 32px 40px; }
#view-recent .feed-sentinel { max-width: 860px; margin: 0 auto; padding: 8px 32px 90px; }

/* The mockup's "Jump back in" strip was a horizontally scrolling row, which
   leaves the page with a child whose scrollWidth exceeds its clientWidth. Wrap
   it instead: same cards, same density, nothing scrolls sideways. */
#recent-viewed-grid.recent-strip { flex-wrap: wrap; overflow-x: visible; }

/* ═══════════════════════════════════════════════════════════════════════════
   PREVIEW MEDIA SIZING — the `.fit` layer

   Phase 2 ported the markup and the engine but NOT this. `assetPreviewHtml`
   emits class="fit" plus an inline
       width: min(100%, calc(var(--fit-h) * W / H))
   and the new stylesheet defined neither --fit-h nor any rule for <video>
   inside the two preview containers. With --fit-h undefined the calc() is
   invalid, the whole width declaration is dropped, and nothing caps the
   element — so a 3840x2160 master rendered at 3840x2160 inside a 1032px
   frame (measured in real Chrome: box 3840x2160 on the asset page, 3686x2074
   in quick look). Ported from public/style.css:624-640 and 1319-1341, retuned
   to this design's chrome heights.
   ═══════════════════════════════════════════════════════════════════════════ */
#asset-page-preview.asset-preview-content {
  /* Height budget: viewport, less the topbar, less this pane's own header
     (~57px) and footer (~46px), less its 40px padding top and bottom. */
  --fit-h: max(160px, calc(100vh - var(--topbar-h) - 190px));
  overflow: hidden;
}
#asset-page-preview img,
#asset-page-preview video {
  max-width: 100%;
  max-height: var(--fit-h);
  object-fit: contain;
  display: block;
  border-radius: 10px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.6);
}
/* Width comes from the inline rule above; height just follows the ratio. */
#asset-page-preview img.fit,
#asset-page-preview video.fit { height: auto; max-height: var(--fit-h); }
#asset-page-preview audio { width: min(560px, 100%); }
#asset-page-preview .audio-stack {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: min(560px, 100%);
}
#asset-page-preview .audio-art {
  width: 220px; height: 220px; object-fit: cover; border-radius: var(--radius);
}
#asset-page-preview .audio-art.placeholder {
  display: grid; place-items: center; font-size: 54px;
  background: var(--surface); color: var(--text-tertiary);
}
#asset-page-preview iframe.yt-embed {
  width: min(100%, 1280px, calc(var(--fit-h) * 16 / 9));
  aspect-ratio: 16/9; max-height: var(--fit-h);
  border: 0; border-radius: 10px; background: #000;
}
#asset-page-preview .source-fallback {
  position: relative; display: inline-block; max-width: min(100%, 960px);
  border-radius: 10px; overflow: hidden; box-shadow: 0 14px 50px rgba(0,0,0,0.6);
}
#asset-page-preview .source-fallback img { display: block; max-width: 100%; max-height: var(--fit-h); }
#asset-page-preview .play-overlay {
  position: absolute; inset: auto 0 0 0; padding: 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff; font-size: 14px; font-weight: 500; text-align: center;
}
/* The failure card is a panel, not media — it must not inherit the shadow or
   the media max-height, and it should sit at a readable width. */
#asset-page-preview .media-unplayable,
.ql-body .media-unplayable { box-shadow: var(--shadow-md); }

.ql-body {
  /* .ql-card is max-height 88vh; head ~66px, foot ~50px, plus body padding. */
  --fit-h: max(120px, min(74vh, calc(88vh - 140px)));
  padding: 16px;
}
.ql-body img, .ql-body video {
  max-width: 100%; max-height: var(--fit-h);
  object-fit: contain; display: block; border-radius: 10px;
}
.ql-body img.fit, .ql-body video.fit { height: auto; max-height: var(--fit-h); }
.ql-body audio { width: min(520px, 100%); }
.ql-body .audio-stack {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: min(520px, 100%);
}
.ql-body .audio-art { width: 200px; height: 200px; object-fit: cover; border-radius: var(--radius); }
.ql-body .audio-art.placeholder {
  display: grid; place-items: center; font-size: 48px;
  background: var(--surface); color: var(--text-tertiary);
}
.ql-body iframe.yt-embed {
  width: min(100%, 1100px, calc(var(--fit-h) * 16 / 9));
  aspect-ratio: 16/9; max-height: var(--fit-h);
  border: 0; border-radius: 10px; background: #000;
}
.ql-body .source-fallback {
  position: relative; display: inline-block; max-width: min(100%, 860px);
  border-radius: 10px; overflow: hidden;
}
.ql-body .source-fallback img { display: block; max-width: 100%; max-height: var(--fit-h); }
.ql-body .play-overlay {
  position: absolute; inset: auto 0 0 0; padding: 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff; font-size: 14px; font-weight: 500; text-align: center;
}

/* --- typed placeholder art (assets that can never have a thumbnail) -------- */
/* Audio has no visual and .md/.json/.psd are not renderable, so ~1,265 assets
   are glyph-only forever. Make that look intentional instead of broken. */
.thumb-glyph .ph-art,
.asset-thumb.placeholder .ph-art {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-tertiary);
}
.ph-art svg { width: 30%; max-width: 44px; min-width: 16px; height: auto; opacity: 0.85; }
.ph-ext {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
/* A faint type tint so a wall of placeholders still reads as sorted, not empty. */
.ph-art[data-kind="audio"]    { color: #a78bfa; background: linear-gradient(150deg, rgba(167,139,250,.10), transparent 62%); }
.ph-art[data-kind="video"]    { color: #6ea8fe; background: linear-gradient(150deg, rgba(110,168,254,.10), transparent 62%); }
.ph-art[data-kind="image"]    { color: #5ec8a0; background: linear-gradient(150deg, rgba(94,200,160,.10), transparent 62%); }
.ph-art[data-kind="document"] { color: #f0a868; background: linear-gradient(150deg, rgba(240,168,104,.10), transparent 62%); }
.ph-art[data-kind="file"]     { color: #8a93a5; background: linear-gradient(150deg, rgba(138,147,165,.10), transparent 62%); }
/* Small surfaces (activity rows, strips, folder mosaics): icon only. */
.recent-thumb .ph-ext, .activity-thumb .ph-ext, .run-thumb .ph-ext,
.strip-thumb .ph-ext, .fgroup-thumbs .ph-ext, .asset-grid.list-view .ph-ext { display: none; }
.recent-thumb .ph-art svg, .activity-thumb .ph-art svg, .run-thumb .ph-art svg,
.strip-thumb .ph-art svg, .fgroup-thumbs .ph-art svg { width: 40%; }

.audio-art.placeholder { position: relative; overflow: hidden; }

/* The onerror fallback glyph must stay hidden until the image actually fails.
   There was no base rule hiding it, so every successfully-loaded activity and
   feed thumbnail was also painting a glyph on top of itself — invisible while
   the glyph was a dim emoji, obvious once it gained a tinted background.
   `.thumb-failed` is added by the img's onerror handler. */
.thumb-glyph.fallback:not(.x),
.fgroup-thumbs .fgt .thumb-glyph.fallback,
.asset-thumb .thumb-glyph.fallback,
.strip-thumb .thumb-glyph.fallback { display: none; }
.thumb-failed .thumb-glyph.fallback,
.fgroup-thumbs .fgt.thumb-failed .thumb-glyph.fallback,
.asset-thumb.thumb-failed .thumb-glyph.fallback,
.strip-thumb.thumb-failed .thumb-glyph.fallback { display: grid; }
.thumb-failed .thumb-img { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   UPLOAD PROPERTY GROUPS  (fix — applies at every width)

   renderUploadProperties() emits .prop-label / .prop-values / .option-grid /
   .value-chip. None of those four classes had a single CSS rule, so the chips
   rendered as bare inline spans with no padding and no gaps — which is where
   "PortfolioWorkSolutions" and "Work page · HeroWork page · Episodes" came
   from. They were never separate words running together; they were unstyled
   chips sitting flush against each other. .prop-row already existed, so only
   its two children and the chip needed defining.
   ═══════════════════════════════════════════════════════════════════════════ */
.prop-label {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 132px;
  flex: 0 0 132px;
  padding-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.35;
}
.prop-values {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.option-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.value-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.value-chip:hover { border-color: rgba(255,255,255,0.22); color: var(--text); }
.value-chip.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Search overlay section headers — emitted by renderSearchOverlay() at every
   width, so they need a base rule as well as the mobile one. */
.search-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 4px;
}
.search-section-head .search-section-label { padding: 0; }
.search-see-all {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  flex: 0 0 auto;
}
.search-see-all:hover { color: var(--accent-hover); }
.search-result-meta .warn { color: var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE CHROME — hidden by default so desktop is byte-for-byte unchanged.
   Both blocks are switched on only inside the <768px media query below.
   ═══════════════════════════════════════════════════════════════════════════ */
.mtop { display: none; }
.mobile-nav { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   ███  MOBILE  —  < 768px  ███
   The Frame.io iOS pattern: the side rail disappears entirely and navigation
   becomes a floating pill at the bottom. Everything else grows. This is a
   different layout, not a squeezed one. Nothing above 768px is touched.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  :root {
    --m-gut: 16px;                                  /* side margin */
    --m-navh: 76px;                                 /* pill height + float gap */
    --m-safe: env(safe-area-inset-bottom, 0px);
  }

  /* ── Shell: rail + tree panel + desktop topbar all gone ───────────────── */
  .rail,
  .assets-panel,
  .topbar { display: none !important; }

  .app { display: block; height: 100dvh; }
  .main { height: 100dvh; display: flex; flex-direction: column; }

  .content > div[id^="view-"] {
    padding: 0 var(--m-gut);
    /* the pill floats OVER content — the last row has to clear it */
    padding-bottom: calc(var(--m-navh) + var(--m-safe) + 24px);
    -webkit-overflow-scrolling: touch;
  }

  /* Type scale steps up across the board (spec §6) */
  body { font-size: 17px; }

  /* ── Bottom nav pill ──────────────────────────────────────────────────── */
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(16px + var(--m-safe));
    z-index: 200;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(28,28,32,0.82);
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    /* Above the search sheet (z-index 300): in the reference the pill is never
       covered, and a Search you cannot tap your way back out of is a trap. */
    z-index: 400;
  }
  .mnav-item {
    position: relative;
    width: 64px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: transparent;
    transition: background 0.18s, color 0.18s;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-item .ic { width: 26px; height: 26px; stroke-width: 1.7; }
  .mnav-item.active {
    background: rgba(255,255,255,0.13);      /* active sits in its own chip */
    color: var(--text);
  }
  .mnav-badge {
    position: absolute;
    top: 3px;
    right: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
  }

  /* ── Top bar, row 1 ───────────────────────────────────────────────────── */
  .mtop {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 6px var(--m-gut) 0;
    background: rgba(10,10,10,0.86);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .mtop-row1 {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
  }
  .mtop-circ {
    width: 44px;
    height: 44px;                       /* 44px minimum touch target */
    flex: 0 0 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.07);
    color: var(--text);
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .mtop-circ:active { background: rgba(255,255,255,0.14); }
  .mtop-circ .ic { width: 21px; height: 21px; }
  .mtop-circ.sm { width: 42px; height: 42px; flex-basis: 42px; }
  .mtop-plus { background: var(--accent); color: #fff; }
  .mtop-plus:active { background: var(--accent-active); }

  .mtop-titlewrap {
    flex: 1 1 auto;
    min-width: 0;                       /* the reason "Cr / L" happened */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .mtop-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .mtop-caret {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.09);
    color: var(--text-secondary);
  }
  .mtop-caret .ic { width: 14px; height: 14px; stroke-width: 2.2; }

  /* Root screens: big left-aligned title, no back button, no caret */
  .mtop.root .mtop-titlewrap { justify-content: flex-start; }
  .mtop.root .mtop-title { font-size: 30px; }
  .mtop.root .mtop-caret { display: none; }

  .mtop-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 2px solid var(--bg-elevated);
  }

  /* ── Top bar, row 2: the control strip ────────────────────────────────── */
  .mtop-row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0 8px;
  }
  .mseg {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 11px;
    background: rgba(255,255,255,0.07);
    flex: 0 0 auto;
  }
  .mseg-btn {
    width: 46px;
    height: 36px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
  }
  .mseg-btn .ic { width: 19px; height: 19px; }
  .mseg-btn.active { background: rgba(255,255,255,0.14); color: var(--text); }
  .mstrip-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

  /* ── Top bar, row 3: the count line ───────────────────────────────────── */
  .mtop-row3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0 10px;
    border-bottom: 1px solid var(--border);
  }
  .mcount { font-size: 16px; color: var(--text-secondary); }
  .mcount-chev {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    color: var(--text-tertiary);
    flex: 0 0 32px;
  }
  .mcount-chev .ic { width: 18px; height: 18px; }
  .mtop.collapsed .mcount-chev { transform: rotate(-90deg); }

  /* Strip + count line are library furniture only */
  body:not([data-tab="library"]) .mtop-row2,
  body:not([data-tab="library"]) .mtop-row3 { display: none; }
  .mtop-row3.hidden, .mtop-row2.hidden { display: none; }

  /* ── Grid: 2 columns, uniform cards ───────────────────────────────────── */
  .folder-grid,
  .asset-grid:not(.list-view) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px;
  }
  /* the fixed-column override from the desktop slider must not win here */
  .asset-grid.cols-fixed { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  .asset-card, .fcard { border-radius: 14px; }
  .asset-card:hover, .fcard:hover { transform: none; }   /* no hover lift on touch */
  .asset-body { padding: 10px 11px 12px; }
  .asset-title { font-size: 16px; line-height: 1.3; }
  .asset-grid:not(.list-view) .asset-title,
  .asset-grid:not(.list-view) .asset-meta { height: auto; }
  .asset-grid:not(.list-view) .asset-title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .asset-meta { font-size: 14px; }
  .asset-duration { font-size: 12px; padding: 3px 6px; }
  /* hover-only affordances have no meaning on touch */
  .asset-play, .asset-actions, .fcard-check, .asset-check { display: none !important; }
  .fcard-menu { opacity: 1; }
  .fcard-name { font-size: 16px; }
  .fcard-meta { font-size: 14px; }

  /* ── List view: 88px rows, 96x72 thumb ────────────────────────────────── */
  .asset-grid.list-view { gap: 0; }
  .asset-grid.list-view .asset-card {
    min-height: 88px;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    position: relative;
  }
  /* hairline inset to start at the text, not the thumb */
  .asset-grid.list-view .asset-card::after {
    content: '';
    position: absolute;
    left: 110px; right: 0; bottom: 0;
    height: 1px;
    background: var(--border);
  }
  .asset-grid.list-view .asset-card:last-child::after { display: none; }
  .asset-grid.list-view .asset-thumb {
    width: 96px;
    height: 72px;
    aspect-ratio: auto;
    flex: 0 0 96px;
    border-radius: 8px;
    overflow: hidden;
  }
  .asset-grid.list-view .asset-thumb .thumb-img { object-fit: cover; }
  .asset-grid.list-view .asset-body {
    flex: 1 1 auto;
    max-width: calc(100% - 110px);      /* 96px thumb + 14px gap */
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    padding: 0;
    min-width: 0;
  }
  .asset-grid.list-view .asset-title {
    font-size: 18px;
    line-height: 1.26;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    flex: 0 0 auto;
  }
  .asset-grid.list-view .asset-meta { font-size: 15px; color: var(--text-tertiary); }
  /* Title + one subtitle line only — the tag row was making an 88px row 135px. */
  .asset-grid.list-view .asset-tags { display: none; }
  .asset-grid.list-view .asset-title,
  .asset-grid.list-view .asset-meta { max-width: 100%; min-width: 0; }
  .asset-grid.list-view .asset-duration {
    right: 5px; bottom: 5px;
    font-size: 12px; padding: 2px 6px;
    border-radius: 5px;
    background: rgba(0,0,0,0.78);
    color: #fff;
  }
  .asset-grid.list-view .asset-badge { display: none; }

  /* ── Section heads / dividers ─────────────────────────────────────────── */
  .lib-head { flex-wrap: wrap; gap: 6px; }
  .section-title { font-size: 21px; }
  .files-divider { margin: 18px 0 12px; }

  /* ── Everything that used to spill past the right edge ────────────────── */
  /* Horizontal scroll strips become wrapping rows: a strip that scrolls
     sideways still puts geometry past the viewport, which is exactly what
     the "zero horizontal overflow" rule forbids. */
  .search-filters,
  .views-rail,
  .tbar-left,
  .tbar-right,
  .fbar-row,
  .tag-list,
  .settings-tabs,
  .chip-row {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    max-width: 100%;
  }
  .search-filter-pill { flex: 0 0 auto; font-size: 13px; padding: 7px 13px; }

  /* Any chip long enough to be wider than the phone would otherwise define the
     min-content width of its flex row and push it past the right edge. Tag
     values come from user data, so the cap has to be unconditional. */
  .tag-chip, .chip, .search-filter-pill, .view-pill, .fbar-active .chip {
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .asset-tags, .fbar-active, .prop-val, .meta-value { min-width: 0; max-width: 100%; flex-wrap: wrap; }

  /* The desktop toolbar rows all duplicate what the control strip's circular
     buttons already do, and stacked they pushed the grid a full screen down.
     They collapse behind the "..." overflow button — tapping it reveals the
     whole block, so nothing is lost, it is just not the default. */
  #view-library .library-toolbar,
  #view-library .views-rail,
  #view-library .filter-bar,
  #view-library .breadcrumb { display: none; }
  body.m-tools-open #view-library .library-toolbar,
  body.m-tools-open #view-library .views-rail,
  body.m-tools-open #view-library .filter-bar { display: flex; }
  body.m-tools-open #view-library .views-rail.hidden,
  body.m-tools-open #view-library .filter-bar.hidden { display: none; }
  body.m-tools-open #mb-more { background: rgba(255,255,255,0.18); color: var(--text); }
  body.m-views-open #view-library .views-rail:not(.hidden) { display: flex; }
  .mtop-circ.active { background: rgba(255,255,255,0.18); color: var(--text); }
  #view-library .views-rail { padding: 10px 0; gap: 8px; }

  .library-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 0; }
  .sort-wrap, .fbar-select, .tbtn-wrap { max-width: 100%; min-width: 0; }
  .sort-wrap select, .fbar-select { max-width: 100%; min-width: 0; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 10px; }

  /* Uniform cards: a 2-line name and a wrapping meta line made every folder
     card a different height, which is the exact thing the design forbids. */
  .fcard-name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
  }
  /* Subfolders inside a folder are a flex strip of 180px cards on desktop;
     at 390px that renders one per screen. Same 2-up grid as everything else. */
  .subfolder-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
  }
  .subfolder-row .fcard.sm { width: auto; margin-top: 0; }
  .subfolder-row .fcard.sm .fcard-name { font-size: 15px; }

  /* The circular back button in the top bar already does this. */
  #asset-back { display: none; }
  .asset-preview-nav { gap: 8px; }

  .fcard-meta { flex-wrap: nowrap; gap: 8px; }
  .fcard-meta > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Drawers and side panels become full-bleed sheets */
  .activity-panel,
  .share-panel {
    width: 100% !important;
    max-width: 100% !important;
    border-left: 0;
  }
  .activity-panel-body { padding-bottom: calc(var(--m-navh) + var(--m-safe)); }

  .btn, .btn.sm { min-height: 40px; max-width: 100%; }
  .btn.primary { max-width: 100%; }

  /* ── Search screen (spec §5) ──────────────────────────────────────────── */
  .search-modal { padding: 0; align-items: stretch; }
  .search-modal-card {
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    transform: none;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .search-modal.active .search-modal-card { transform: none; }
  .search-input-wrap {
    margin: 12px var(--m-gut);
    height: 52px;
    border-radius: 26px;
    background: var(--surface);
    padding: 0 16px;
  }
  .search-input { font-size: 17px; }
  .search-kbd { display: none; }
  .search-filters { padding: 0 var(--m-gut) 12px; gap: 8px; }
  .search-results { max-height: none; flex: 1; padding-bottom: calc(var(--m-navh) + var(--m-safe)); }
  .search-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px var(--m-gut) 6px;
  }
  .search-section-label { font-size: 15px; color: var(--text-secondary); }
  .search-see-all { font-size: 15px; color: var(--accent); font-weight: 500; }
  .search-result-item { min-height: 64px; padding: 10px var(--m-gut); gap: 14px; }
  .search-result-thumb { width: 60px; height: 46px; border-radius: 8px; flex: 0 0 60px; }
  .search-result-title { font-size: 17px; }
  .search-result-meta { font-size: 15px; }
  .search-result-meta .warn { color: var(--danger); }
  .search-footer { display: none; }

  /* ── Upload screen (spec §7) ──────────────────────────────────────────── */
  .upload-options { grid-template-columns: 1fr; gap: 18px; }
  .upload-option-row { grid-column: 1 / -1 !important; min-width: 0; }
  .upload-label { font-size: 15px; margin-bottom: 2px; }
  .upload-select,
  .upload-text-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 48px;
    font-size: 17px;
  }
  .upload-header h2 { font-size: 27px; }
  .upload-header p  { display: none; }
  .upload-header { margin-bottom: 18px; }

  /* The picker comes right after Creator / Folder / Note. In source order it
     sits under every tag group — about six screens down on a phone — which
     made "+" look like it led nowhere. Tags move below it; they are optional. */
  .upload-layout { display: flex; flex-direction: column; }
  .upload-layout > .upload-header     { order: 1; }
  .upload-layout > .upload-options    { order: 2; margin-bottom: 18px; }
  .upload-layout > .upload-dropzone   { order: 3; margin-bottom: 20px; }
  .upload-layout > .upload-queue      { order: 4; margin: 0 0 24px; }
  .upload-layout > .upload-properties { order: 5; }
  .upload-dropzone {
    border-color: var(--accent);
    background: var(--accent-bg);
  }
  .upload-dropzone .dz-desk { display: none; }
  .upload-dropzone .dz-touch { display: inline; }

  /* tag groups: label ON ITS OWN LINE above its chips, real gaps between */
  .prop-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 0;
  }
  .prop-label { width: auto; flex: 0 0 auto; padding-top: 0; font-size: 14px; }
  .prop-values, .option-grid { gap: 8px; }
  .value-chip {
    font-size: 14px;
    padding: 8px 13px;
    min-height: 36px;
    /* A chip whose label is longer than the phone is wide would otherwise set
       the flex container's min-content width and push the whole row off the
       right edge — several category options are full sentences. */
    white-space: normal;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .upload-properties, .upload-properties .prop-row, .prop-values { min-width: 0; max-width: 100%; }

  /* Tables lay out inside the phone instead of scrolling sideways: a table
     that scrolls still puts thead/tbody geometry past the viewport, which is
     the thing the no-horizontal-overflow rule exists to prevent. */
  table, .creators-table {
    display: table;
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
  }
  .creators-table th, .creators-table td {
    padding: 10px 8px;
    font-size: 14px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  /* Five columns will not read on a 390px screen. Creator + last scan carry
     the meaning; the two platform columns fold into the row below. */
  .creators-table th:nth-child(2), .creators-table td:nth-child(2),
  .creators-table th:nth-child(3), .creators-table td:nth-child(3) { display: none; }

  .upload-dropzone { padding: 32px 16px; }
  .upload-item { gap: 12px; }
  .upload-item-name { font-size: 16px; }
  .upload-item-meta { font-size: 14px; }

  /* ── Sync / Instagram / Settings: stack every label+control pair ──────── */
  .sync-control-row,
  .ig-control-row,
  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
  }
  .sync-input, .sync-select, .ig-input, .settings-input, input[type="text"], input[type="search"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .sync-label, .ig-label, .settings-label { width: auto; font-size: 15px; }

  /* .sync-controls is a single flex ROW on desktop, which squeezed four inputs
     and a button into 358px. One control per line instead. */
  .sync-controls, .ig-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
  }
  .sync-controls > *, .ig-controls > * { width: 100%; max-width: 100%; }
  .sync-input { height: 46px; font-size: 16px; }
  .sync-checkbox { display: flex; align-items: center; gap: 10px; min-height: 44px; }
  .sync-controls .btn { justify-content: center; min-height: 46px; }

  /* Instagram account rows are avatar + text + two buttons on one flex line;
     at 390px the text column collapsed to about 40px and wrapped mid-word.
     Avatar and name stay on the first line, the actions move below. */
  .ig-acct {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "avatar main" "actions actions";
    gap: 10px 12px;
    align-items: start;
    padding: 14px;
  }
  .ig-acct-avatar { grid-area: avatar; width: 44px; height: 44px; flex: none; }
  .ig-acct-main   { grid-area: main; min-width: 0; }
  .ig-acct-actions {
    grid-area: actions;
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .ig-acct-actions .pg-btn { flex: 1 1 0; min-height: 42px; white-space: nowrap; }
  .ig-acct-sub, .ig-acct-name { min-width: 0; overflow-wrap: anywhere; }
  .ig-acct-sub .tag-chip { display: inline; }
  .sync-checkbox { max-width: 100%; }
  .sync-layout, .instagram-layout, .settings-layout, .upload-layout { max-width: 100%; }

  /* ── Dashboard ────────────────────────────────────────────────────────── */
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 16px; min-width: 0; }

  /* ── Asset detail: one column, preview above the metadata ─────────────── */
  #view-asset { padding: 0 !important; overflow-y: auto; }
  .asset-detail-layout {
    /* desktop is `1fr 400px`; the 400px track is what pushed the sidebar and
       the header's action row past the right edge of a 390px phone */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    min-height: 100%;
  }
  .asset-preview-area { overflow: visible; min-width: 0; }
  .asset-preview-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px var(--m-gut);
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .asset-preview-nav { order: 3; }
  .asset-preview-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
    max-width: 100%;
    row-gap: 8px;
  }
  .asset-preview-actions .btn { flex: 0 0 auto; }
  .asset-preview-content { padding: 12px var(--m-gut); min-width: 0; }
  .asset-preview-content img,
  .asset-preview-content video { max-width: 100%; height: auto; }
  .asset-preview-footer, .asset-info-bar { flex-wrap: wrap; padding: 10px var(--m-gut); }
  .asset-metadata-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 16px var(--m-gut);
    padding-bottom: calc(var(--m-navh) + var(--m-safe) + 16px);
    overflow: visible;
  }
  .asset-meta-scroll { padding: 16px 0; overflow: visible; }
  .meta-row, .prop-row, .src-row { flex-wrap: wrap; min-width: 0; }
  .meta-label, .prop-key { min-width: 0; }

  /* Raw CDN URLs in the metadata are one unbreakable token — without an
     explicit break they render as a single ~1260px-wide inline box. */
  #view-asset a, #view-asset .meta-value, #view-asset code,
  .asset-metadata-sidebar a, .activity-panel a {
    max-width: 100%;
    display: inline-block;
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  /* ── Global belt-and-braces: nothing gets to be wider than the phone ──── */
  .app, .main, .content, .content > div[id^="view-"] { max-width: 100vw; overflow-x: hidden; }

  /* The FAB duplicates the top-bar "+" and would sit under the nav pill. */
  .fab { display: none; }

  /* Tooltips are a pointer affordance; on touch they only ever mis-fire. */
  .rail .nav-item::after, .rail-btn::after { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DOWNLOAD POPOVER (#dl-menu, built by openDownloadMenu in app.js)
   Ported from legacy-style.css on 2026-09-07. The v3.1 restyle carried over
   the bulk sheet (.dl-sheet-*) but not the per-asset size menu, so the menu
   rendered as a static, full-width block at the bottom of <body> — below the
   viewport — and Download looked dead. app.js sets top/left inline; these
   rules give it position, surface, and layering.
   ═══════════════════════════════════════════════════════════════════════════ */
.dl-menu {
  position: absolute; z-index: 210; width: 340px; padding: 8px;
  background: var(--bg-elevated, var(--surface)); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: calc(100vh - 20px);
  color: var(--text);
}
.dl-head {
  flex: 0 0 auto; display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 650; color: var(--text-secondary); padding: 4px 6px 8px;
  text-transform: uppercase; letter-spacing: .04em;
}
.dl-menu-sub { font-size: 11px; font-weight: 650; letter-spacing: .02em; text-transform: none; color: var(--text-tertiary); }
.dl-net {
  flex: 0 0 auto; font-size: 11px; line-height: 1.35; color: var(--warning);
  padding: 6px 8px; margin: 0 2px 6px; border-radius: 8px; background: rgba(251,191,36,.10);
}
.dl-rows { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 1px; }
.dl-row {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left;
  padding: 9px 8px; border-radius: 9px; border: 1px solid transparent; background: none;
  color: var(--text); font: inherit; cursor: pointer;
}
.dl-row:hover:not(.is-off):not(:disabled) { background: var(--surface-hover); border-color: var(--border-subtle); }
.dl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dl-row-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.dl-row-main b { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.dl-row-main em { font-style: normal; font-size: 11px; color: var(--text-tertiary); line-height: 1.35; }
/* The size is the whole point of the menu — tabular figures so a column lines up. */
.dl-size {
  flex: 0 0 auto; font-size: 12px; font-weight: 650; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dl-tag {
  font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent); background: var(--accent-bg);
  border-radius: 5px; padding: 1px 5px;
}
.dl-row.is-off { cursor: default; opacity: .55; }
.dl-row.is-off .dl-size { color: var(--text-tertiary); }
.dl-row.is-gone { opacity: .75; }
.dl-row.is-gone .dl-row-main em { color: var(--danger); }
.dl-row.is-going { background: var(--accent-bg); border-color: var(--accent); }
.dl-row.is-going .dl-size { color: var(--accent); }
.dl-row.is-done { background: rgba(52,211,153,.10); border-color: rgba(52,211,153,.30); }
.dl-row.is-done .dl-row-main em { color: var(--success); }
.dl-row.is-failed { background: rgba(244,84,79,.09); border-color: rgba(244,84,79,.38); }
.dl-row.is-failed .dl-row-main em, .dl-row.is-failed .dl-size { color: var(--danger); }
.dl-row.dl-external { text-decoration: none; }
.dl-row:disabled { opacity: .4; cursor: not-allowed; }
/* Skeletons rather than the word "loading", so the panel does not jump. */
.dl-row.is-skel { pointer-events: none; }
.dl-row.is-skel b, .dl-row.is-skel em, .dl-row.is-skel .dl-size {
  background: linear-gradient(90deg, var(--surface-hover), var(--border), var(--surface-hover));
  background-size: 200% 100%; animation: dl-shimmer 1.2s linear infinite;
  border-radius: 4px; color: transparent;
}
.dl-row.is-skel b { width: 38%; height: 11px; }
.dl-row.is-skel em { width: 72%; height: 9px; }
.dl-row.is-skel .dl-size { width: 44px; height: 11px; }
@keyframes dl-shimmer { to { background-position: -200% 0; } }
.dl-empty, .dl-error { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; font-size: 12px; line-height: 1.45; }
.dl-empty b, .dl-error b { font-size: 13px; }
.dl-empty span, .dl-error span { color: var(--text-tertiary); }
.dl-error b { color: var(--danger); }
.dl-linkbtn {
  align-self: flex-start; background: none; border: 0; padding: 2px 0 0; font: inherit;
  color: var(--accent); text-decoration: underline; cursor: pointer;
}
.dl-foot { flex: 0 0 auto; font-size: 11px; padding: 8px 6px 2px; border-top: 1px solid var(--border-subtle); margin-top: 6px; line-height: 1.4; color: var(--text-tertiary); }
.dl-foot:empty { display: none; }
/* On a phone the popover becomes a bottom sheet. */
.dl-menu.as-sheet {
  position: fixed; top: auto !important; left: 0 !important; right: 0; bottom: 0;
  width: auto; max-height: 72vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 12px 12px calc(12px + var(--m-safe, 0px));
}
.dl-menu.as-sheet .dl-row { padding: 12px 10px; min-height: 44px; }
.dl-menu [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .dl-row.is-skel b, .dl-row.is-skel em, .dl-row.is-skel .dl-size { animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOVE TO FOLDER SHEET (opened from the selection bar)
   ═══════════════════════════════════════════════════════════════════════════ */
.mv-card { display: flex; flex-direction: column; max-height: 82vh; }
.mv-card .filter-sheet-head { margin-bottom: 14px; }
.mv-net {
  padding: 8px 12px; margin-bottom: 10px; border-radius: 8px; font-size: 12.5px;
  background: rgba(255,170,0,0.10); border: 1px solid rgba(255,170,0,0.35); color: #ffb020;
}
.mv-list {
  margin-top: 10px;
  min-height: 160px;
  max-height: 44vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.mv-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; border: 0; background: none;
  color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.mv-row:last-child { border-bottom: 0; }
.mv-row:hover { background: var(--surface-hover); }
.mv-row.picked { background: var(--accent-bg); color: var(--accent); }
.mv-row.picked .mv-cnt { color: var(--accent); opacity: 0.8; }
.mv-row.current { cursor: default; color: var(--text-tertiary); }
.mv-row.current:hover { background: none; }
.mv-row .ic { flex: none; width: 16px; height: 16px; opacity: 0.7; }
.mv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-cnt { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.mv-pill {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  padding: 2px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-tertiary);
}
.mv-msg { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--text-tertiary); line-height: 1.5; }
.mv-msg b { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.mv-msg .btn { margin-top: 12px; }
.mv-skel { height: 38px; border-bottom: 1px solid var(--border); position: relative; overflow: hidden; }
.mv-skel::after {
  content: ''; position: absolute; inset: 11px 40% 11px 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-hover) 25%, rgba(255,255,255,0.08) 50%, var(--surface-hover) 75%);
  background-size: 200% 100%; animation: mv-shimmer 1.2s linear infinite;
}
@keyframes mv-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.mv-new { margin-top: 12px; }
.mv-new-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  border: 1px dashed var(--border); background: none; color: var(--text-secondary); font-size: 13px; cursor: pointer;
}
.mv-new-toggle:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.mv-new-toggle.open { display: none; }
.mv-new-form { display: flex; gap: 8px; align-items: center; }
.mv-new-form.hidden { display: none; }
.mv-new-form .sheet-field { flex: 1; }
.mv-new .sheet-hint { margin: 6px 0 0; min-height: 0; }
.mv-new .sheet-hint:empty { display: none; }
.mv-actions { align-items: center; }
.mv-result { flex: 1; margin: 0; text-align: left; }
.mv-result.err { color: #ff6b6b; }
.mv-result.ok { color: var(--accent); }
@media (max-width: 640px) {
  .mv-list { max-height: 38vh; }
  .mv-actions { flex-wrap: wrap; }
  .mv-result { flex-basis: 100%; }
}
.mv-new .sheet-hint.err { color: #ff6b6b; }
/* Bottom sheets must clear the floating nav pill, or their action row (Move,
   Apply, Download) lands underneath it and cannot be tapped. */
@media (max-width: 767px) {
  .filter-sheet-card { padding-bottom: calc(var(--m-navh) + var(--m-safe) + 16px); max-height: 92vh; }
  .mv-card .mv-list { max-height: 34vh; }
}

/* ─── client portal (admin) ─── */
.cp-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 4px 0; }
.cp-toggle input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.cp-toggle span b { font-weight: 600; font-size: 13.5px; }
.cp-toggle span small { display: block; color: var(--text-tertiary); font-size: 12px; }
.cp-toggle-state { margin-left: auto; font-size: 12px; color: var(--text-tertiary); }
.cp-toggle-state.is-on { color: #4ade80; font-weight: 600; }
.cp-toggle-msg { margin: 6px 0 0 28px; padding: 6px 10px; border-radius: 6px; font-size: 12.5px; line-height: 1.4; border: 1px solid transparent; }
.cp-toggle-msg.hidden { display: none; }
.cp-toggle-msg.pending { color: var(--text-secondary); background: var(--bg-elevated, rgba(127,127,127,.08)); }
.cp-toggle-msg.ok   { color: #4ade80; background: rgba(22,163,74,.10); border-color: rgba(22,163,74,.35); }
.cp-toggle-msg.warn { color: #fbbf24; background: rgba(234,179,8,.12); border-color: rgba(234,179,8,.40); }
.cp-toggle-msg.err  { color: #f87171; background: rgba(220,38,38,.10); border-color: rgba(220,38,38,.40); }
.asset-page-save-bar .save-bar-hint { margin-right: auto; font-size: 12px; color: var(--text-tertiary); align-self: center; }
.cp-link { display: flex; gap: 8px; align-items: center; }
.cp-link .sheet-field { flex: 1; min-width: 0; font-size: 12px; }
.cp-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.cp-items { min-height: 60px; max-height: 30vh; }
.cp-item .cp-type { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-tertiary); width: 40px; flex: none; }
.cp-item a { color: var(--accent); }
.cp-status { font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.cp-add { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cp-comments { max-height: 30vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.cp-comment { background: var(--surface-hover, rgba(127,127,127,.12)); border-radius: 10px; padding: 8px 10px; font-size: 13px; }

/* ══════════════════════════════════════════════════════════════════════════
   ADD TO JW DESIGN STUDIO  —  the design + slide picker
   Tokens only, no hex literals. Bottom sheet under 640px, matching every
   other menu in this app (and the iPad answer).
   ══════════════════════════════════════════════════════════════════════════ */

.jwds-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.jwds-panel {
  position: fixed; z-index: 301;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop-in 0.14s ease-out;
}

.jwds-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-subtle);
}
.jwds-head-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jwds-head-txt b { font-size: 15px; color: var(--text); }
.jwds-head-txt em { font-style: normal; font-size: 12px; color: var(--text-tertiary); }
.jwds-x {
  margin-left: auto; flex: none;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 0; color: var(--text-secondary); cursor: pointer;
}
.jwds-x:hover { background: var(--surface-hover); color: var(--text); }

/* The asset being placed. Always visible, so you can see WHAT you are placing. */
.jwds-asset {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}
.jwds-asset img, .jwds-asset-ph {
  width: 40px; height: 40px; flex: none; border-radius: 8px;
  object-fit: cover; background: var(--surface-active);
}
.jwds-asset-meta { display: flex; flex-direction: column; min-width: 0; }
.jwds-asset-meta b {
  font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jwds-asset-meta em { font-style: normal; font-size: 11px; color: var(--text-tertiary); }

.jwds-search { padding: 10px 16px 0; }
.jwds-search input {
  width: 100%; padding: 8px 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none;
}
.jwds-search input:focus { border-color: var(--accent); }

.jwds-body { overflow-y: auto; padding: 10px 16px 16px; flex: 1; min-height: 0; }

/* ── the design list ── */
.jwds-list { display: flex; flex-direction: column; gap: 4px; }
.jwds-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text);
  cursor: pointer; text-align: left;
}
.jwds-row:hover { background: var(--surface-hover); }
.jwds-thumb {
  width: 44px; height: 44px; flex: none; border-radius: 8px;
  object-fit: cover; background: var(--surface-active);
}
.jwds-letter {
  display: grid; place-items: center;
  font-size: 17px; font-weight: 600; color: var(--text-tertiary);
}
.jwds-row-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.jwds-row-main b {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jwds-row-main em { font-style: normal; font-size: 11px; color: var(--text-tertiary); }
.jwds-row.is-skel { pointer-events: none; height: 60px; }
.jwds-row.is-skel span, .jwds-row.is-skel em {
  display: block; border-radius: 6px; background: var(--surface-hover);
  animation: jwds-pulse 1.2s ease-in-out infinite;
}
.jwds-row.is-skel span { width: 44px; height: 44px; flex: none; }
.jwds-row.is-skel em { height: 10px; flex: 1; }
@keyframes jwds-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }

/* ── how to place it ── */
.jwds-seg {
  display: flex; gap: 4px; padding: 3px; margin-bottom: 12px;
  background: var(--surface); border-radius: 9px; border: 1px solid var(--border-subtle);
}
.jwds-seg button {
  flex: 1; padding: 6px 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-secondary);
  font-size: 12px; cursor: pointer;
}
.jwds-seg button.on { background: var(--surface-active); color: var(--text); }

/* ── the slide filmstrip ── */
.jwds-slides {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
.jwds-slide {
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
  border: 2px solid transparent; border-radius: 10px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer;
}
.jwds-slide:hover { background: var(--surface-hover); }
.jwds-slide.sel { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.jwds-slide em { font-style: normal; font-size: 11px; text-align: center; }
.jwds-slide.is-skel { height: 104px; pointer-events: none; animation: jwds-pulse 1.2s ease-in-out infinite; }

/* The preview host. The iframe inside is scaled from its true page size, so
   this box clips it — the scale factor is computed against this box. */
.jwds-prev {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1 / 1; border-radius: 6px;
  background: var(--surface-active);
  font-size: 10px; color: var(--text-tertiary);
  display: grid; place-items: center;
}
.jwds-prev iframe {
  position: absolute; top: 0; left: 0;
  border: 0; transform-origin: top left; pointer-events: none;
}
.jwds-prev.is-dead { color: var(--text-tertiary); }

.jwds-new { justify-content: center; }
.jwds-new .jwds-plus {
  display: grid; place-items: center; aspect-ratio: 1 / 1;
  border: 1px dashed var(--border); border-radius: 6px;
  font-size: 20px; color: var(--text-tertiary);
}

/* ── footer / actions ── */
.jwds-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-subtle);
}
.jwds-actions { display: flex; gap: 8px; margin-top: 14px; }
.jwds-btn {
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); text-decoration: none; display: inline-block;
}
.jwds-btn:hover { background: var(--surface-hover); }
.jwds-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.jwds-btn.primary:hover { background: var(--accent-hover); }
.jwds-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── the flat states: empty, error, offline, success ── */
.jwds-state {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 22px 4px; text-align: left;
}
.jwds-state b { font-size: 14px; color: var(--text); }
.jwds-state span { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.jwds-state .jwds-note { color: var(--text-tertiary); font-size: 11.5px; }
.jwds-error b { color: var(--danger); }
.jwds-ok b { color: var(--success); }
.jwds-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; color: var(--text-tertiary);
  background: var(--surface); padding: 3px 6px; border-radius: 5px;
  user-select: all;
}

/* ── phone / iPad: a bottom sheet, like every other menu here ── */
@media (max-width: 640px) {
  .jwds-panel {
    top: auto; bottom: 0; left: 0;
    transform: none;
    width: 100%; max-width: 100%;
    max-height: 88vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
  }
  .jwds-slides { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .jwds-foot { position: sticky; bottom: 0; background: var(--bg-elevated); }
}

/* ── The bottom sheet must clear the floating mobile nav ──────────────────
   Found by the handoff gate at 320px, 2026-09-26: the download menu becomes
   a bottom sheet at `bottom: 0`, and #mobile-nav is a floating pill sitting
   on top of it. Playwright refused to click the LAST row because the nav
   "intercepts pointer events" - which is exactly what happens to a thumb.
   Every row was reachable until a sheet grew long enough to reach the pill,
   which is why this survived: it only bites the bottom-most row.
   --m-navh is the pill height plus its float gap, and --m-safe is the home
   indicator, so this is the real clearance, not a guess. */
@media (max-width: 767px) {
  .dl-menu.as-sheet {
    padding-bottom: calc(var(--m-navh, 76px) + var(--m-safe, 0px) + 12px);
  }
  .jwds-panel {
    padding-bottom: calc(var(--m-navh, 76px) + var(--m-safe, 0px));
  }
  .jwds-panel .jwds-foot {
    padding-bottom: 12px;
  }
}

/* Explicit editorial status is independent of upload/source badges. */
.asset-edit-status { position:absolute; right:8px; top:8px; padding:3px 6px; background:var(--surface); color:var(--text); font-size:10px; border-radius:4px; }
.asset-duration { max-width:calc(100% - 16px); }
.asset-card .asset-actions { gap:4px; flex-wrap:wrap; }

.asset-status-control { display:flex; gap:6px; align-items:center; color:var(--text-secondary); font-size:11px; margin:6px 0; }
.asset-status-control select { color:var(--text); background:var(--surface); border:1px solid var(--border); border-radius:4px; padding:3px; max-width:110px; }
.asset-thumb .fallback { display:none; }
.asset-thumb.thumb-failed .fallback { display:block; }

@media (max-width: 640px) {
  .asset-card .asset-actions { display:flex !important; opacity:1; }
  .asset-grid.list-view .asset-card .asset-actions { display:flex !important; position:static; }
}

.asset-card:focus-within .asset-actions { opacity:1; }
.asset-card .asset-duration { top:38px; bottom:auto; right:8px; z-index:2; }
.asset-grid.list-view .asset-card .asset-duration { top:auto; bottom:4px; }

.upload-folder-list { height:150px; overflow-y:auto; scrollbar-width:auto; padding:4px; }
.upload-folder-list::-webkit-scrollbar, #mv-list::-webkit-scrollbar { width:8px; display:block; }
.upload-folder-list::-webkit-scrollbar-thumb, #mv-list::-webkit-scrollbar-thumb { background:var(--text-tertiary); border-radius:4px; }
#mv-list { scrollbar-width:auto; }
.upload-folder-list option { padding:6px 8px; }
#up-destination { color:var(--text); font-size:12px; overflow-wrap:anywhere; }
.upload-properties > summary { cursor:pointer; padding:12px 0; color:var(--text); }
#up-tags-count { font-size:12px; color:var(--text-secondary); margin-left:8px; }
.upload-properties #up-presets { max-height:240px; overflow-y:auto; scrollbar-width:auto; }
.folder-upload-hint { color:var(--text-secondary); font-size:12px; margin-left:12px; }
.upload-options { align-items:start; }

.ct-drop-target { outline:2px solid var(--accent); outline-offset:-2px; background:var(--accent-bg); }


/* Pending files occupy the same grid as the folder's registered assets. */
.folder-uploads { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; color: var(--text-secondary); font-size: 13px; }
.folder-uploads[hidden] { display: none; }
.upload-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elevated); }
.upload-card-thumb { aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--surface); color: var(--accent); font-size: 32px; }
.upload-card-body, #upload-transfer-list li, #upload-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
.upload-card-body { padding: 14px; }
.upload-card .name, #upload-transfer-list .name { font-weight: 500; overflow-wrap: anywhere; }
.upload-card progress, #upload-transfer-list progress, #upload-list progress { grid-column: 1 / -1; width: 100%; height: 6px; border: 0; border-radius: 8px; accent-color: var(--accent); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--border); border-radius: 8px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 8px; transition: width .15s linear; }
.upload-card .state, .upload-card .upload-destination, #upload-transfer-list .state, #upload-transfer-list .upload-destination, #upload-list .upload-destination { grid-column: 1 / -1; overflow-wrap: anywhere; font-size: 13px; color: var(--text-secondary); }
.upload-card .err, #upload-transfer-list .err { color: var(--danger); }
#upload-transfer-list .ok { color: var(--success); }
.upload-card .pct, #upload-transfer-list .pct { font-variant-numeric: tabular-nums; }
.upload-transfers { position: fixed; inset: 0 0 0 auto; margin: 0; width: 400px; max-width: 92vw; height: 100dvh; max-height: 100dvh; padding: 20px; border: 0; border-left: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); overflow-y: auto; }
.upload-transfers::backdrop { background: rgba(0, 0, 0, .4); }
.upload-transfer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.upload-transfer-head h3 { font-size: 16px; }
#upload-transfer-summary { margin: 14px 0; font-size: 13px; }
#upload-transfer-list { list-style: none; margin: 0; padding: 0; }
#upload-transfer-list li { border-bottom: 1px solid var(--border); padding: 18px 0; }
.upload-folder-link { grid-column: 1 / -1; justify-self: start; background: none; border: 0; color: var(--accent); padding: 0; font-size: 13px; }
.upload-card .retry-btn, #upload-transfer-list .retry-btn { margin-left: 6px; }

#mb-transfers[hidden] { display: none; }
.mobile-nav { max-width: calc(100vw - 16px); }
.asset-actions-menu { position: fixed; z-index: 1100; width: 260px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.asset-actions-heading { padding: 8px 10px; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.asset-actions-menu button { display: block; width: 100%; text-align: left; padding: 10px; min-height: 40px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 14px; }
.asset-actions-menu button:hover, .asset-actions-menu button:focus-visible { background: var(--surface-active); }
.asset-actions-menu button.danger { color: var(--danger); }
.asset-actions-menu button:disabled { opacity: .4; cursor: default; }

.folder-move-dialog { background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:12px; padding:20px; width:360px; max-width:calc(100vw - 24px); }
.folder-move-dialog::backdrop { background:rgba(0,0,0,.5); }
.folder-move-dialog h3 { margin-bottom:16px; }
.folder-move-dialog select { width:100%; margin:8px 0 16px; }
.folder-move-dialog [role=status] { color:var(--danger); font-size:13px; }
@media (max-width: 600px) {
  .asset-page-save-bar { flex-wrap: wrap; }
  .asset-page-save-bar .save-bar-hint { flex-basis: 100%; }
}
