/* ==========================================================================
   BloomScrolling Design System & Stylesheet
   ========================================================================== */

:root {
  --bg-main: #090D16;
  --bg-sidebar: #0E131F;
  --bg-card: #131927;
  --bg-card-hover: #182032;
  --bg-input: #101624;
  --bg-accent-subtle: #1E293B;

  --border-subtle: #1E293B;
  --border-focus: #6366F1;
  --border-card: #1E2A3F;

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-inverse: #090D16;

  /* Sophisticated Indigo Accent */
  --accent-primary: #6366F1;
  --accent-primary-hover: #4F46E5;
  --accent-primary-light: rgba(99, 102, 241, 0.12);

  --accent-indigo: #6366F1;
  --accent-emerald: #10B981;
  --accent-emerald-light: rgba(16, 185, 129, 0.12);
  --accent-amber: #F59E0B;
  --accent-rose: #EF4444;
  --accent-sky: #0EA5E9;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 16px;
  gap: 24px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: cover;
  border-radius: var(--radius-md);
  display: block;
}

.mobile-brand-logo {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Sections */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.icon-btn-subtle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.icon-btn-subtle:hover {
  color: var(--text-primary);
  background-color: var(--bg-accent-subtle);
}

/* Navs */
.folder-nav, .format-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item-row {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  width: 100%;
}

.nav-item-row:hover {
  background-color: var(--bg-accent-subtle);
}

.nav-item-row.active {
  background-color: var(--accent-primary-light);
}

.nav-item-row.active .nav-label {
  color: var(--accent-primary);
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  flex: 1;
  min-width: 0;
}

.nav-item:hover {
  background-color: var(--bg-accent-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--accent-primary-light);
  color: var(--accent-primary);
  font-weight: 700;
}

.folder-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 6px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.nav-item-row:hover .folder-actions,
.nav-item-row:focus-within .folder-actions {
  opacity: 1;
}

.folder-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.folder-action-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

.folder-action-btn.btn-delete-folder:hover {
  color: var(--accent-rose, #ef4444);
  background-color: rgba(239, 68, 68, 0.15);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-main);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.nav-item.active .nav-count {
  background-color: var(--accent-primary);
  color: white;
}

/* Platform Chips */
.platform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-accent-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
}

.chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.chip.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #FFFFFF;
}

.demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.demo-chip svg {
  width: 13px;
  height: 13px;
  stroke: var(--accent-primary);
}

.card-folder {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-folder svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
}

.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.cat-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.icon-text-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  width: 100%;
}

.icon-text-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-accent-subtle);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 32px 60px 32px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  gap: 20px;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 40px 10px 38px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background-color: var(--accent-primary);
  color: #FFFFFF;
}

.view-toggle {
  display: flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.view-btn.active {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34D399;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.db-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60A5FA;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: pulse-dot 2s infinite ease-in-out;
}

.status-dot.db-online {
  background-color: #3B82F6;
  box-shadow: 0 0 8px #3B82F6;
}

/* Auth & User Profile */
.auth-container {
  display: flex;
  align-items: center;
}

.google-login-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.google-login-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(66, 133, 244, 0.4);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-primary);
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.btn-logout-icon:hover {
  color: #EF4444;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Content Header */
.content-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.content-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.content-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.header-stats {
  display: flex;
  gap: 10px;
}

.stat-pill {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Quick Ingest Bar */
.quick-ingest-bar {
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(21, 27, 43, 0.6) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.quick-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 14px;
  transition: border-color var(--transition-fast);
}

.quick-input-group:focus-within {
  border-color: var(--border-focus);
}

.link-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.quick-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-sans);
}

.quick-input-group input:focus {
  outline: none;
}

.quick-demos {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.demo-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.demo-chip {
  background-color: var(--bg-main);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.demo-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background-color: var(--bg-accent-subtle);
}

/* Cards Container & Items Grid (Grid & List View) */
.cards-container {
  width: 100%;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.items-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Knowledge Card */
.knowledge-card, .k-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  gap: 12px;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  position: relative;
}

.knowledge-card:hover, .k-card:hover {
  transform: translateY(-3px);
  border-color: rgba(236, 72, 153, 0.45);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(236, 72, 153, 0.15);
}

.card-header, .k-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-badges, .k-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-platform {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-platform.instagram {
  background-color: rgba(225, 48, 108, 0.12);
  color: #F472B6;
  border: 1px solid rgba(225, 48, 108, 0.25);
}

.badge-platform.tiktok {
  background-color: rgba(0, 242, 234, 0.12);
  color: #38BDF8;
  border: 1px solid rgba(0, 242, 234, 0.25);
}

.badge-platform.youtube {
  background-color: rgba(255, 0, 0, 0.12);
  color: #F87171;
  border: 1px solid rgba(255, 0, 0, 0.25);
}

.card-folder {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.card-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.card-menu-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.card-title, .k-card-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
}

.card-summary, .k-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Action Items Checklist Inside Card */
.card-actions-wrapper {
  background: rgba(11, 15, 23, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-actions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.action-progress {
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.action-list, .k-action-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-item, .k-action-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.35;
  cursor: pointer;
}

.action-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.action-item.completed .action-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.card-snippet, .k-code-preview {
  background-color: #080B10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #F472B6;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 80px;
}

.card-footer, .k-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  gap: 8px;
}

.card-tags, .k-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag, .k-tag {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.card-meta {
  white-space: nowrap;
  font-size: 0.74rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #DB2777 0%, #BE185D 100%);
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.btn-danger {
  background-color: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background-color: var(--accent-rose);
  color: #FFF;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 6px 12px;
}

.btn-block {
  width: 100%;
}

.btn-capture {
  background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);
  padding: 11px 16px;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.25);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card-lg {
  max-width: 820px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 1.4rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-sidebar);
}

/* ==========================================================================
   WIZARD STYLING (ONBOARDING)
   ========================================================================== */

.wizard-card {
  max-width: 680px;
  position: relative;
}

.wizard-progress-bar {
  width: 100%;
  height: 4px;
  background-color: var(--bg-input);
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #EC4899, #8B5CF6);
  transition: width 0.3s ease;
}

.wizard-step {
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.wizard-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wizard-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wizard-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wizard-header p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}

.wizard-feature-boxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.w-feature-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.w-feature-box.highlight {
  background-color: rgba(236, 72, 153, 0.08);
  border-color: rgba(236, 72, 153, 0.3);
}

.w-box-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.w-feature-box strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.w-feature-box p {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Category Grid in Wizard */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.cat-card {
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.cat-card input {
  position: absolute;
  opacity: 0;
}

.cat-card:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-card-hover);
}

.cat-card.selected,
.cat-card:has(input:checked) {
  border-color: var(--accent-primary) !important;
  background-color: rgba(236, 72, 153, 0.16) !important;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.25) !important;
}

.cat-icon {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.cat-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Format Preferences Grid */
.format-preferences-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pref-card input {
  position: absolute;
  opacity: 0;
}

.pref-card:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-card-hover);
}

.pref-card.selected,
.pref-card:has(input:checked) {
  border-color: var(--accent-primary) !important;
  background-color: rgba(236, 72, 153, 0.16) !important;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.25) !important;
}

.pref-icon {
  font-size: 1.3rem;
}

.pref-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.pref-info span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Style Choice Cards */
.style-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.style-choice-card {
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.style-choice-card:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-card-hover);
}

.style-choice-card.selected,
.style-choice-card:has(input:checked) {
  border-color: var(--accent-primary) !important;
  background-color: rgba(236, 72, 153, 0.16) !important;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.25) !important;
}

.style-choice-card input {
  position: absolute;
  opacity: 0;
}

.style-choice-card:hover {
  border-color: var(--accent-primary);
}

.style-choice-card.selected {
  border-color: var(--accent-primary);
  background-color: rgba(236, 72, 153, 0.12);
}

.sc-content strong {
  font-size: 0.92rem;
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

.sc-content p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* Multi-select Pills in Capture Modal */
.multi-select-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-checkbox {
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.pill-checkbox input {
  position: absolute;
  opacity: 0;
}

.pill-checkbox:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.pill-checkbox.selected,
.pill-checkbox:has(input:checked) {
  background-color: rgba(236, 72, 153, 0.16) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.2) !important;
}

/* Style Toggle Mini (In Capture Modal) */
.style-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.style-choice-mini {
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  position: relative;
}

.style-choice-mini input {
  position: absolute;
  opacity: 0;
}

.style-choice-mini:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.style-choice-mini.selected,
.style-choice-mini:has(input:checked) {
  border-color: var(--accent-primary) !important;
  background-color: rgba(236, 72, 153, 0.14) !important;
  color: #FFF !important;
}

/* Interactive Tour Tooltips */
.tour-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1500;
}

.tour-popover {
  position: fixed;
  z-index: 1600;
  background-color: var(--bg-card);
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 320px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(236, 72, 153, 0.3);
  animation: slideUp 0.2s ease-out;
}

.tour-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-step-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
}

.tour-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.tour-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.tour-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 14px;
}

.tour-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tour-highlight {
  position: relative;
  z-index: 1550 !important;
  box-shadow: 0 0 0 4px var(--accent-primary), 0 0 25px rgba(236, 72, 153, 0.5) !important;
  border-radius: var(--radius-md);
}

/* Detail Modal Styles */
.detail-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.3;
}

.detail-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-input);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.detail-source-link {
  color: var(--accent-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-source-link:hover {
  text-decoration: underline;
}

.detail-markdown-content {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #E2E8F0;
}

.detail-markdown-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 18px 0 8px 0;
  color: var(--text-primary);
}

.detail-markdown-content ul, 
.detail-markdown-content ol {
  padding-left: 20px;
  margin-bottom: 14px;
}

.detail-markdown-content li {
  margin-bottom: 6px;
}

/* Phone Simulator */
.phone-modal-card {
  max-width: 480px;
  background-color: #0D111A;
}

.phone-frame-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.phone-mockup {
  width: 320px;
  height: 560px;
  background-color: #000;
  border-radius: 36px;
  border: 4px solid #334155;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.phone-notch {
  width: 100px;
  height: 18px;
  background-color: #1E293B;
  border-radius: 0 0 12px 12px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.phone-screen {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.phone-reel-mock {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #371B28 0%, #0F172A 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 16px;
}

.reel-overlay-content {
  z-index: 5;
  margin-bottom: 20px;
}

.reel-creator {
  font-size: 0.8rem;
  font-weight: 700;
  color: #FFF;
  margin-bottom: 6px;
}

.reel-caption {
  font-size: 0.75rem;
  color: #CBD5E1;
  line-height: 1.3;
}

.reel-side-actions {
  position: absolute;
  right: 14px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  z-index: 5;
}

.reel-action-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFF;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reel-action-btn.highlight-btn {
  background-color: var(--accent-primary);
  border-color: #F472B6;
  animation: pulse-share 1.5s infinite;
}

@keyframes pulse-share {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 0 15px var(--accent-primary); }
}

.phone-sharesheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #1E293B;
  border-radius: 20px 20px 0 0;
  padding: 12px 14px 20px 14px;
  z-index: 10;
  animation: slideUp 0.2s ease-out;
}

.sharesheet-handle {
  width: 36px;
  height: 4px;
  background-color: #475569;
  border-radius: var(--radius-full);
  margin: 0 auto 10px auto;
}

.sharesheet-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94A3B8;
  margin-bottom: 12px;
}

.sharesheet-apps {
  display: flex;
  justify-content: space-around;
  margin-bottom: 12px;
}

.share-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  color: #CBD5E1;
  cursor: pointer;
}

.share-app-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.share-app-icon.whatsapp { background-color: #25D366; color: white; }
.share-app-icon.clipbrain-icon { 
  background: linear-gradient(135deg, #EC4899, #8B5CF6); 
  color: white; 
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.6);
}
.share-app-icon.notes { background-color: #F59E0B; color: white; }
.share-app-icon.copy { background-color: #475569; color: white; }

.phone-clipbrain-popup {
  background-color: #0F172A;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.p-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #F8FAFC;
}

.badge-gemini {
  background-color: rgba(236, 72, 153, 0.2);
  color: #F472B6;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.p-multi-select {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.p-pill {
  background-color: #1E293B;
  border: 1px solid #334155;
  color: #CBD5E1;
  font-size: 0.65rem;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.p-pill.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.p-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #94A3B8;
}

.p-select {
  background-color: #1E293B;
  border: 1px solid #334155;
  color: #CBD5E1;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 4px;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 16px;
}

.flex-1 {
  flex: 1;
}

.input-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color var(--transition-fast);
}

.input-with-icon:focus-within {
  border-color: var(--border-focus);
}

.input-with-icon input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
}

.input-with-icon input:focus {
  outline: none;
}

input[type="text"],
input[type="password"],
input[type="url"],
.custom-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  width: 100%;
}

input:focus, .custom-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-help {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.form-help a {
  color: var(--accent-primary);
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  gap: 12px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin-bottom: 8px;
}

.settings-danger-zone {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-danger-zone h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
}

.danger-row p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Mobile Navigation & Responsive Components */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 13, 22, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1400;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.sidebar-close-btn {
  display: none;
  background: var(--bg-accent-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  transition: all var(--transition-fast);
}

.sidebar-close-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.topbar-mobile-header {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

/* Utility Helpers */
.hidden {
  display: none !important;
}

/* ==========================================
   Mobile & Smartphone Responsive Rules
   ========================================== */
@media (max-width: 900px) {
  .desktop-only {
    display: none !important;
  }

  /* App Layout & Sidebar Mobile Drawer */
  .app-layout {
    display: block;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 310px;
    max-width: 86vw;
    z-index: 1500;
    background-color: var(--bg-sidebar);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 18px 16px 30px 16px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  /* Mobile Topbar Header */
  .topbar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-menu-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .mobile-menu-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-brand-logo {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-subtle);
  }

  .mobile-brand-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.02em;
  }

  .mobile-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Main Content & Topbar */
  .main-content {
    padding: 0 0 85px 0;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .topbar {
    padding: 0 0 12px 0;
    margin-bottom: 16px;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-subtle);
  }

  .topbar-search {
    max-width: 100%;
    width: calc(100% - 32px);
    margin: 0 16px;
  }

  .topbar-actions {
    display: none;
  }

  /* Content Header & Stats */
  .content-header {
    padding: 0 16px;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
  }

  .header-left h1 {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  .header-left p {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .header-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
  }

  .stat-pill {
    padding: 8px 6px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    border-radius: var(--radius-md);
  }

  .stat-num {
    font-size: 1.1rem;
    font-weight: 800;
  }

  .stat-label {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
  }

  /* Quick Ingest Bar */
  .quick-ingest-bar {
    margin: 0 16px 16px 16px;
    padding: 12px;
  }

  .quick-input-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
  }

  .quick-input-group input {
    padding: 6px 4px;
    font-size: 0.9rem;
  }

  .quick-input-group button {
    width: 100%;
    padding: 10px;
    font-size: 0.88rem;
  }

  .quick-demos {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 4px 0 2px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .quick-demos::-webkit-scrollbar {
    display: none;
  }

  .demo-chip {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Knowledge Cards Grid */
  .cards-container, .items-grid {
    padding: 0 16px;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .k-card, .knowledge-card {
    width: 100%;
    margin: 0;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-subtle);
    justify-content: space-around;
    align-items: center;
    z-index: 1200;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
  }

  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    gap: 3px;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: color 0.15s ease;
    padding: 4px 0;
  }

  .mobile-nav-btn svg {
    stroke: currentColor;
  }

  .mobile-nav-btn.active {
    color: var(--accent-primary);
  }

  .mobile-nav-btn-primary {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    transform: translateY(-10px);
    border: 3px solid var(--bg-sidebar);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .mobile-nav-btn-primary:active {
    transform: translateY(-7px) scale(0.96);
  }

  /* Modals as Native Bottom Sheets */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 !important;
    border-top: 1px solid var(--border-focus);
    animation: slideUpModal 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .modal-body {
    padding: 16px;
    gap: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .wizard-step {
    padding: 20px 16px;
    gap: 16px;
  }

  .wizard-header h2 {
    font-size: 1.25rem;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 280px;
  }

  .cat-card {
    padding: 10px;
  }

  .cat-name {
    font-size: 0.82rem;
  }

  .cat-sub {
    font-size: 0.68rem;
  }

  .detail-source-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  @keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Toast position above bottom nav */
  .toast {
    bottom: 74px;
    left: 16px;
    right: 16px;
    max-width: calc(100% - 32px);
  }
}

@media (max-width: 480px) {
  .header-stats {
    gap: 6px;
  }

  .stat-pill {
    padding: 6px 4px;
  }

  .stat-num {
    font-size: 0.95rem;
  }

  .stat-label {
    font-size: 0.6rem;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   RPG Character HUD & Level Progression
   ========================================== */

.rpg-character-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(236, 72, 153, 0.35);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  max-width: 520px;
}

.rpg-level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  border-radius: 12px;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.45);
  font-family: var(--font-heading);
  line-height: 1;
  animation: badgePulse 3s infinite ease-in-out;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 14px rgba(236, 72, 153, 0.4); transform: scale(1); }
  50% { box-shadow: 0 0 22px rgba(139, 92, 246, 0.6); transform: scale(1.03); }
}

.rpg-lvl-text {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.rpg-lvl-num {
  font-size: 1.25rem;
  font-weight: 800;
}

.rpg-info-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rpg-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rpg-rank-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.rpg-xp-counter {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.rpg-xp-bar-bg {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.rpg-xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #38bdf8);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: xpGlow 2.5s infinite linear;
}

@keyframes xpGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.stat-pill.rpg-stat {
  border-color: rgba(236, 72, 153, 0.4);
  background: rgba(236, 72, 153, 0.08);
}

.stat-pill.rpg-stat .stat-num {
  color: #ec4899;
}

/* Floating XP Popup Animation */
.floating-xp-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
}

.floating-xp {
  position: absolute;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.6), 0 4px 10px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  animation: floatUpFade 1.4s forwards ease-out;
}

@keyframes floatUpFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.6);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -15px) scale(1.1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -45px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -65px) scale(0.85);
  }
}

/* ==========================================
   Interactive Library Bookshelf (3D Grimoires)
   ========================================== */

.bookshelf-view {
  width: 100%;
  padding: 10px 0 40px 0;
}

.bookshelf-header {
  margin-bottom: 24px;
}

.bookshelf-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
}

.bookshelf-icon {
  font-size: 2rem;
}

.bookshelf-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.bookshelf-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.bookshelf-furniture {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 48px;
  perspective: 1200px;
}

.shelf-tier {
  position: relative;
  width: 100%;
}

.shelf-books-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 0 32px 0 32px;
  min-height: 240px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.shelf-wood-beam {
  position: relative;
  height: 20px;
  background: linear-gradient(180deg, #382513 0%, #23160a 60%, #170d06 100%);
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), inset 0 2px 3px rgba(255, 255, 255, 0.15), inset 0 -2px 3px rgba(0, 0, 0, 0.5);
  border-top: 1.5px solid #5c3c1e;
}

.shelf-plank-shadow {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 100%);
}

/* 3D Grimoire Book Styles */
.grimoire-book {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 220px;
  cursor: pointer;
  border-radius: 6px 6px 2px 2px;
  padding: 16px 8px 12px 8px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: bottom center;
  user-select: none;
  box-shadow: -4px 0 12px rgba(0,0,0,0.5), inset 2px 0 4px rgba(255,255,255,0.15), inset -2px 0 4px rgba(0,0,0,0.4);
}

.grimoire-book:hover {
  transform: translateY(-20px) scale(1.05) rotate(-2deg);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(236, 72, 153, 0.4);
  z-index: 10;
}

/* Dynamic Thickness Levels */
.book-thickness-thin {
  width: 48px;
  min-width: 48px;
  background: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  border-left: 2px solid #475569;
}

.book-thickness-medium {
  width: 66px;
  min-width: 66px;
  background: linear-gradient(90deg, #4c1d95 0%, #6d28d9 50%, #4c1d95 100%);
  border-left: 2px solid #a78bfa;
}

.book-thickness-thick {
  width: 86px;
  min-width: 86px;
  background: linear-gradient(90deg, #831843 0%, #be185d 50%, #831843 100%);
  border-left: 3px solid #f472b6;
}

.book-thickness-ancient {
  width: 106px;
  min-width: 106px;
  background: linear-gradient(90deg, #78350f 0%, #b45309 50%, #78350f 100%);
  border-left: 3px solid #fbbf24;
  border-right: 2px solid #d97706;
}

.grimoire-ribbon {
  position: absolute;
  top: -8px;
  right: 10px;
  width: 10px;
  height: 24px;
  background: #ec4899;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

.grimoire-spine-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.grimoire-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.grimoire-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 120px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.grimoire-page-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 6px;
  border-radius: 999px;
  line-height: 1;
}

/* ==========================================
   Interactive 2-Page Grimoire Flipbook Reader Modal
   ========================================== */

.book-reader-card {
  max-width: 980px !important;
  width: 95vw;
  background: #121826;
  border: 2px solid rgba(236, 72, 153, 0.4);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(236, 72, 153, 0.25);
}

.book-reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.book-reader-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-folder-icon {
  font-size: 1.8rem;
}

.book-folder-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.book-page-indicator {
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
}

/* Two-Page Spread */
.open-book-spread {
  display: grid;
  grid-template-columns: 1fr 12px 1fr;
  min-height: 480px;
  background: #171f30;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.book-spine-divider {
  background: linear-gradient(90deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0.5) 100%);
  border-left: 1px solid rgba(255,255,255,0.05);
  border-right: 1px solid rgba(255,255,255,0.05);
  height: 100%;
}

.book-page {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.page-corner-decor {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 14px;
  height: 14px;
  border-top: 1.5px solid rgba(236, 72, 153, 0.4);
  border-right: 1.5px solid rgba(236, 72, 153, 0.4);
}

.left-page .page-corner-decor {
  right: auto;
  left: 10px;
  border-right: none;
  border-left: 1.5px solid rgba(236, 72, 153, 0.4);
}

.book-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.book-platform-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.book-creator-tag {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.book-item-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.35;
}

.book-summary-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  border-left: 3px solid var(--accent-primary);
}

.book-summary-box h4,
.book-actions-box h4,
.book-tools-box h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.book-summary-box p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.book-snippet-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #38bdf8;
}

.book-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.book-page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 12px;
}

.book-link-btn {
  font-size: 0.8rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
}

.page-number {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-read-xp {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid var(--accent-primary);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-read-xp:hover {
  background: var(--accent-primary);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
}

.badge-xp {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  color: #38bdf8;
}

.book-action-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.book-tools-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.btn-edit-book-note {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-edit-book-note:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-primary);
}

.book-reader-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 16px;
}

.book-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
}

.book-ribbon-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ribbon-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ribbon-dot.active {
  background: var(--accent-primary);
  transform: scale(1.3);
  box-shadow: 0 0 10px var(--accent-primary);
}

/* ==========================================
   Level-Up Celebration Modal
   ========================================== */

.level-up-modal-card {
  text-align: center;
  background: radial-gradient(circle at top, #1e1b4b 0%, #0f172a 100%) !important;
  border: 2px solid #ec4899 !important;
  box-shadow: 0 0 50px rgba(236, 72, 153, 0.5) !important;
  position: relative;
  overflow: hidden;
}

.level-up-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.45) 0%, transparent 70%);
  pointer-events: none;
}

.level-up-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.level-up-sparkle {
  font-size: 1.8rem;
  animation: sparkleAnim 1.5s infinite alternate;
}

@keyframes sparkleAnim {
  0% { transform: scale(0.8) rotate(0deg); opacity: 0.6; }
  100% { transform: scale(1.3) rotate(20deg); opacity: 1; }
}

.level-up-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 18px;
  box-shadow: 0 0 30px rgba(236, 72, 153, 0.7);
  color: #ffffff;
  font-family: var(--font-heading);
}

.level-up-badge-txt {
  font-size: 0.75rem;
  font-weight: 800;
}

.level-up-badge-num {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.level-up-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(236, 72, 153, 0.6);
}

.level-up-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.level-up-rank-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
}

.level-up-rank-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  font-weight: 700;
}

.level-up-rank-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  margin: 6px 0;
}

.level-up-rank-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.level-up-perks {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}

.perk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.level-up-btn {
  font-size: 1.05rem;
  padding: 12px 24px;
}

@media (max-width: 768px) {
  .open-book-spread {
    grid-template-columns: 1fr;
  }
  .book-spine-divider {
    display: none;
  }
}

/* ==========================================
   Integrations & Export Hub Modal Styles
   ========================================== */

.export-hub-card {
  max-width: 760px !important;
  width: 95vw;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
}

.export-nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.export-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.export-tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.export-tab-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

.export-tab-content {
  display: none;
}

.export-tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

.integration-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.int-icon-circle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.int-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.int-info p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.export-options-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.export-feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.feat-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.export-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.export-action-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.eac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.export-action-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.badge-mini {
  font-size: 0.68rem;
  background: rgba(236, 72, 153, 0.15);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.export-action-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.4;
}

@media (max-width: 600px) {
  .export-feature-list,
  .export-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   Print & PDF Stylesheet (@media print)
   ========================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 11pt;
  }

  /* Hide app navigation & interactive UI elements */
  .sidebar,
  .topbar,
  .quick-ingest-bar,
  .mobile-bottom-nav,
  .view-toggle,
  .modal-overlay,
  .rpg-character-badge,
  .card-menu-btn,
  .btn,
  #floating-xp-container,
  #toast {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .content-header h1 {
    font-size: 18pt !important;
    color: #000000 !important;
  }

  .items-grid {
    display: block !important;
  }

  .knowledge-card {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid #d1d5db !important;
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: none !important;
    margin-bottom: 24px !important;
    padding: 16px !important;
  }

  .card-title {
    color: #000000 !important;
    font-size: 14pt !important;
  }

  .card-summary {
    color: #374151 !important;
  }

  .action-item {
    color: #111827 !important;
  }

  .action-item input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: auto !important;
  }

  .card-snippet {
    background: #f3f4f6 !important;
    color: #111827 !important;
    border: 1px solid #e5e7eb !important;
  }
}


