/* ═══════════════════════════════════════════════════════
   NEXUS — CSS Design System
   Dark-first, editorial, with Card Studio visual layer
═══════════════════════════════════════════════════════ */

:root {
  --bg-deep: #08080f;
  --bg-base: #0d0d1a;
  --bg-raised: #121220;
  --bg-card: #16162a;
  --bg-card-hover: #1c1c34;
  --bg-input: #1a1a2e;
  --bg-modal: #0f0f1e;
  --bg-sidebar: #0b0b17;
  --bg-topbar: rgba(8, 8, 15, 0.85);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(139, 92, 246, 0.6);
  --border-accent: rgba(139, 92, 246, 0.3);

  --accent: #8b5cf6;
  --accent-hover: #9d71f8;
  --accent-light: #a78bfa;
  --accent-dark: #6d28d9;
  --accent-glow: rgba(139, 92, 246, 0.25);
  --accent-bg: rgba(139, 92, 246, 0.12);

  --teal: #06d6a0;
  --teal-bg: rgba(6, 214, 160, 0.1);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.1);
  --coral: #f97316;
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.1);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --green: #22c55e;

  --text-primary: #f0f0f8;
  --text-secondary: #8888a8;
  --text-muted: #555570;
  --text-accent: #a78bfa;

  --sidebar-w: 256px;
  --topbar-h: 60px;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --trans: 0.2s var(--ease);
  --trans-md: 0.35s var(--ease);
  --trans-slow: 0.5s var(--ease);

  --font-display: var(--font-body);
  /* follows user's chosen font */
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.8);
  --shadow-accent: 0 0 0 1px var(--border-accent), 0 4px 24px var(--accent-glow);

  /* Type colors */
  --type-youtube: #ff4444;
  --type-article: #3b82f6;
  --type-website: #06d6a0;
  --type-image: #f97316;
  --type-tool: #a78bfa;
  --type-github: #e2e8f0;
  --type-course: #f59e0b;
  --type-book: #34d399;
  --type-reddit: #ff6314;
  --type-twitter: #1d9bf0;
  --type-other: #8888a8;
}

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

html {
  font-size: 16px;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

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

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════
   AUTH SCREEN
══════════════════════════════════════════════════ */
#auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: var(--bg-deep);
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: orb-drift 8s ease-in-out infinite alternate;
}

.auth-orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.auth-orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #06d6a0, transparent 70%);
  bottom: -80px;
  right: -80px;
  animation-delay: -3s;
}

.auth-orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #f97316, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.2;
  animation-delay: -5s;
}

.auth-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes orb-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(30px, 20px) scale(1.1);
  }
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(18, 18, 36, 0.8);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  padding: 48px 52px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: auth-appear 0.6s var(--ease) both;
}

@keyframes auth-appear {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-wordmark {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #8b5cf6, #06d6a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-headline {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.auth-headline em {
  font-style: italic;
  background: linear-gradient(135deg, #a78bfa, #06d6a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 36px;
}

.btn-google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  color: #333;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  transition: var(--trans);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  margin-bottom: 16px;
}

.btn-google-signin:hover {
  background: #f5f5f5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}

.auth-fine {
  color: var(--text-muted);
  font-size: 12px;
}

.auth-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #fb7185;
  text-align: left;
  animation: auth-appear 0.3s var(--ease) both;
}

.auth-error-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.btn-demo-signin {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--trans);
  cursor: pointer;
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

.btn-demo-signin:hover {
  background: var(--accent-bg);
  border-color: var(--border-accent);
  color: var(--accent-light);
  transform: translateY(-1px);
}

.btn-google-signin.loading {
  opacity: 0.7;
  pointer-events: none;
  background: #f5f5f5;
}

.btn-google-signin.loading #google-btn-icon {
  display: none;
}

/* ══════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--trans-md);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 60px 1fr;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: auto;
  transition: var(--trans-md);
  z-index: 100;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #a78bfa, #06d6a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-collapse-btn {
  color: var(--text-muted);
  opacity: 0.5;
  transition: var(--trans);
  padding: 4px;
  border-radius: var(--radius-xs);
}

.sidebar-collapse-btn:hover {
  opacity: 1;
  background: var(--border);
}

.sidebar-nav {
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--trans);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

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

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

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.nav-badge {
  margin-left: auto;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-section-header {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-add-btn {
  color: var(--text-muted);
  opacity: 0.7;
  transition: var(--trans);
  padding: 2px;
  border-radius: var(--radius-xs);
}

.sidebar-add-btn:hover {
  opacity: 1;
  color: var(--accent-light);
}

.sidebar-smart-list {
  padding: 2px 8px;
}

.sidebar-smart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--trans);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-smart-item:hover {
  color: var(--text-primary);
  background: var(--border);
}

.sidebar-smart-item .smart-icon {
  font-size: 14px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-hover);
}

.user-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-name-sm {
  font-size: 13px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email-sm {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Collapsed sidebar ── */
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-badge,
.app-shell.sidebar-collapsed .sidebar-logo span,
.app-shell.sidebar-collapsed .sidebar-section-header span,
.app-shell.sidebar-collapsed .sidebar-smart-item span,
.app-shell.sidebar-collapsed .user-meta,
.app-shell.sidebar-collapsed .sidebar-add-btn {
  display: none;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
}

.app-shell.sidebar-collapsed .nav-item::before {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  align-items: center;
}

.app-shell.sidebar-collapsed .user-avatar-sm {
  margin: 0 auto;
}

/* ── MAIN CONTENT ── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: var(--bg-topbar);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

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

.topbar-search {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 14px 9px 36px;
  color: var(--text-primary);
  font-size: 13.5px;
  transition: var(--trans);
  outline: none;
}

.topbar-search::placeholder {
  color: var(--text-muted);
}

.topbar-search:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-modal);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  margin-top: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.search-suggestions:empty {
  display: none;
}

.search-suggestion-item {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--trans);
  color: var(--text-secondary);
}

.search-suggestion-item:hover {
  background: var(--border);
  color: var(--text-primary);
}

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

.filter-count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

/* ══════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--trans);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-accent);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--trans);
}

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

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  transition: var(--trans);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--border);
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  transition: var(--trans);
}

.btn-ghost-sm:hover {
  color: var(--text-primary);
  background: var(--border);
}

.btn-icon-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  transition: var(--trans);
}

.btn-icon-ghost:hover {
  color: var(--text-primary);
  background: var(--border);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--trans);
}

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

.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  font-size: 12px;
  transition: var(--trans);
  margin-top: 8px;
  width: 100%;
}

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

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

/* ══════════════════════════════════════════════════
   VIEWS
══════════════════════════════════════════════════ */
.view-container {
  flex: 1;
  overflow: hidden;
  overflow-y: auto;
}

.view-container::-webkit-scrollbar {
  width: 4px;
}

.view-container::-webkit-scrollbar-track {
  background: transparent;
}

.view-container::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

.view {
  display: none;
  padding: 32px 28px;
}

.view.active {
  display: block;
  animation: view-in 0.3s var(--ease) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.view-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.view-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.view-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.view-mode-btns {
  display: flex;
  gap: 2px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-mode-btn {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: var(--trans);
  font-size: 13px;
  line-height: 1;
  min-width: 28px;
  text-align: center;
}

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

.view-mode-btn.active {
  color: var(--accent-light);
}

.section-block {
  margin-bottom: 36px;
}

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

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-more {
  color: var(--text-accent);
  font-size: 13px;
}

.section-more:hover {
  color: var(--accent);
}

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: var(--trans);
}

.stat-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card.accent .stat-value {
  color: var(--accent-light);
}

.stat-card.teal .stat-value {
  color: var(--teal);
}

.stat-card.amber .stat-value {
  color: var(--amber);
}

/* ── CARDS GRID ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.cards-grid.three-col {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.cards-rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.cards-rail::-webkit-scrollbar {
  height: 3px;
}

.cards-rail::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

.cards-rail .link-card {
  flex: 0 0 240px;
}

/* ── LINK CARD ── */
.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--trans);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}

.link-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.link-card.visual-mode {
  border: none;
  box-shadow: var(--shadow-md);
}

.card-thumb-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--bg-raised);
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.link-card:hover .card-thumb {
  transform: scale(1.03);
}

.card-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: linear-gradient(135deg, var(--bg-raised), var(--bg-card));
}

.card-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.card-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: var(--trans);
  opacity: 0;
}

.link-card:hover .card-fav-btn {
  opacity: 1;
}

.card-fav-btn.active {
  color: var(--rose);
  opacity: 1;
}

.card-fav-btn:hover {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.2);
}

.card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.card-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.card-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-domain {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.card-domain-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.card-title {
  font-size: var(--cfs-grid, 14px);
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

.card-tag {
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.card-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-actions {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.card-action-btn {
  height: 22px;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  transition: var(--trans);
  opacity: 0.82;
}

.card-action-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* Open URL — green */
.card-btn-open {
  background: #16a34a22;
  color: #22c55e;
  border: 1px solid #22c55e44;
}

.card-btn-open:hover {
  background: #22c55e;
  color: #fff;
}

/* Details — blue */
.card-btn-detail {
  background: #1d4ed822;
  color: #60a5fa;
  border: 1px solid #60a5fa44;
}

.card-btn-detail:hover {
  background: #3b82f6;
  color: #fff;
}

/* Edit — amber */
.card-btn-edit {
  background: #b4530922;
  color: #f59e0b;
  border: 1px solid #f59e0b44;
}

.card-btn-edit:hover {
  background: #f59e0b;
  color: #000;
}

/* Delete — red */
.card-btn-delete {
  background: #9f123822;
  color: #f43f5e;
  border: 1px solid #f43f5e44;
}

.card-btn-delete:hover {
  background: #f43f5e;
  color: #fff;
}

/* Font — purple */
.card-btn-font {
  background: #5b21b622;
  color: #a78bfa;
  border: 1px solid #a78bfa44;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.5px;
  min-width: 28px;
}

.card-btn-font:hover {
  background: #8b5cf6;
  color: #fff;
}

/* Studio — indigo */
.card-action-btn.studio {
  background: #312e8122;
  color: #818cf8;
  border: 1px solid #818cf844;
}

.card-action-btn.studio:hover {
  background: #6366f1;
  color: #fff;
}

/* ── QUICK FONT PICKER POPUP ── */
.qfp-popup {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 280px;
  overflow-y: auto;
  min-width: 196px;
}

.qfp-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.qfp-group {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 6px 8px 2px;
  margin-top: 2px;
}

.qfp-opt {
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  transition: var(--trans);
  width: 100%;
}

.qfp-opt:hover {
  background: var(--border);
  color: var(--text-primary);
}

.qfp-opt.selected {
  color: var(--accent-light);
  background: var(--accent-muted);
  font-weight: 600;
}

.card-rating {
  display: flex;
  gap: 1px;
  font-size: 11px;
}

.card-star {
  color: var(--border-hover);
}

.card-star.filled {
  color: var(--amber);
}

/* ── VISUAL CARD MODE ── */
.link-card.visual-mode .card-body {
  display: none;
}

.visual-card-canvas {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  min-height: 180px;
}

.visual-card-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  z-index: 10;
}

.visual-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s var(--ease);
}

.link-card.visual-mode:hover .visual-card-bg {
  transform: scale(1.04);
}

.visual-card-overlay {
  position: absolute;
  inset: 0;
}

.visual-card-text-zone {
  position: absolute;
  /* top badges ~44px, collection strip 36px + action bar 42px = 78px */
  top: 44px;
  bottom: 78px;
  left: 0;
  right: 0;
  overflow: hidden;
  z-index: 5;
}

/* Reserved collection badge strip — sits between text zone and action bar */
.visual-card-col-strip {
  position: absolute;
  bottom: 42px;
  left: 0;
  right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  z-index: 8;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45) 0%, transparent 100%);
}

.visual-card-col-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px 2px 5px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.visual-text-element {
  position: absolute;
  overflow: hidden;
  /* safety: clips any overflow before JS fitter runs */
}

/* Text position helpers */
.pos-bottom-left {
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-height: calc(100% - 76px);
  /* card height minus action-bar + breathing room */
}

.pos-bottom-center {
  bottom: 16px;
  left: 16px;
  right: 16px;
  text-align: center;
  max-height: calc(100% - 76px);
}

.pos-bottom-right {
  bottom: 16px;
  left: 16px;
  right: 16px;
  text-align: right;
  max-height: calc(100% - 76px);
}

.pos-center {
  top: 50%;
  left: 16px;
  right: 16px;
  transform: translateY(-50%);
  text-align: center;
  max-height: 72%;
}

.pos-top-left {
  top: 16px;
  left: 16px;
  right: 16px;
  max-height: calc(100% - 76px);
}

.pos-top-center {
  top: 16px;
  left: 16px;
  right: 16px;
  text-align: center;
  max-height: calc(100% - 76px);
}

.pos-top-right {
  top: 16px;
  left: 16px;
  right: 16px;
  text-align: right;
  max-height: calc(100% - 76px);
}

/* Shared: never overflow the card */
.visual-text-element,
.studio-text-el {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* ── FONT SCALING BY GRID DENSITY ── */
.cards-grid.grid4-mode .card-title {
  font-size: var(--cfs-grid4, 11px);
  /* JS (fitCardTitles) will shrink further if needed */
  -webkit-line-clamp: 4;
  /* allow up to 4 lines so JS can fit full text */
}

.cards-grid.grid4-mode .card-desc,
.cards-grid.grid4-mode .card-tags {
  display: none;
}

.cards-grid.grid4-mode .card-domain {
  font-size: 10px;
}

.cards-grid.grid4-mode .card-body {
  padding: 8px;
  gap: 5px;
}

.cards-grid.grid2-mode .card-title {
  font-size: var(--cfs-grid2, 16px);
}

.cards-grid.magazine-mode .link-card:nth-child(4n+1) .card-title {
  font-size: 17px;
}

/* ── VISUAL CARD: inside text zone all pos-* are relative to the zone box ── */
/* Zone already enforces top/bottom bounds via overflow:hidden — no extra overrides needed */
.visual-card-canvas .pos-bottom-left,
.visual-card-canvas .pos-bottom-center,
.visual-card-canvas .pos-bottom-right {
  bottom: 0;
}

.visual-card-canvas .pos-top-left,
.visual-card-canvas .pos-top-center,
.visual-card-canvas .pos-top-right {
  top: 0;
  bottom: 0;
  overflow: hidden;
}

/* ── GRID DENSITY MODES ── */
.cards-grid.grid2-mode {
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.cards-grid.grid4-mode {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

/* ── SEQUENCE MODE (full-width stacked cards) ── */
.cards-grid.sequence-mode {
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 700px;
}

.cards-grid.sequence-mode .link-card {
  flex-direction: row;
}

.cards-grid.sequence-mode .card-thumb-wrap {
  width: 200px;
  flex-shrink: 0;
  aspect-ratio: unset;
  min-height: 120px;
  border-radius: 0;
}

.cards-grid.sequence-mode .card-body {
  padding: 16px;
}

.cards-grid.sequence-mode .card-title {
  font-size: var(--cfs-sequence, 16px);
  -webkit-line-clamp: 2;
}

/* ── LIST MODE (compact rows) ── */
.cards-grid.list-mode {
  grid-template-columns: 1fr;
  gap: 8px;
}

.cards-grid.list-mode .link-card {
  flex-direction: row;
  height: 80px;
}

.cards-grid.list-mode .card-thumb-wrap {
  width: 120px;
  height: 80px;
  flex-shrink: 0;
  aspect-ratio: unset;
  border-radius: 0;
}

.cards-grid.list-mode .card-body {
  flex-direction: row;
  align-items: center;
  padding: 10px 14px;
  gap: 12px;
}

.cards-grid.list-mode .card-title {
  font-size: var(--cfs-list, 14px);
  -webkit-line-clamp: 1;
  flex: 1;
}

.cards-grid.list-mode .card-desc {
  display: none;
}

.cards-grid.list-mode .card-tags {
  display: none;
}

/* ── MAGAZINE MODE ── */
.cards-grid.magazine-mode {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(200px, auto);
}

.cards-grid.magazine-mode .link-card:nth-child(4n+1) {
  grid-column: span 2;
}

.cards-grid.magazine-mode .link-card:nth-child(4n+1) .card-thumb-wrap {
  aspect-ratio: 16/7;
}

/* ── TABLE MODE ── */
.library-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.library-table th,
.library-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.library-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
}

.library-table tr:hover td {
  background: var(--bg-raised);
}

.library-table .tbl-thumb {
  width: 48px;
  height: 30px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.library-table .tbl-thumb-placeholder {
  width: 48px;
  height: 30px;
  border-radius: 4px;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.library-table .tbl-title {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.library-table .tbl-domain {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.library-table .tbl-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.library-table .tbl-actions {
  display: flex;
  gap: 3px;
  white-space: nowrap;
}

.library-table .tbl-collection {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tbl-search-row th {
  padding: 4px 6px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.tbl-col-search {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  padding: 3px 7px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.tbl-col-search:focus {
  border-color: var(--accent);
}

.tbl-col-search::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── LIBRARY LAYOUT ── */
.library-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Topbar mode: sidebar hidden, results take full width */
.library-layout.topbar-mode {
  flex-direction: column;
  gap: 0;
}

.library-layout.topbar-mode .filter-panel {
  display: none;
}

.library-layout.topbar-mode .library-results {
  width: 100%;
}

/* ── Filter layout toggle button ── */
.filter-layout-toggle-btn {
  padding: 6px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.filter-layout-toggle-btn.active,
.filter-layout-toggle-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Top Filter Bar ── */
.top-filter-bar {
  width: 100%;
  margin-bottom: 12px;
}

.top-filter-bar.hidden {
  display: none;
}

.tfb-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Dropdown container ── */
.filter-dropdown {
  position: relative;
}

.fdd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.fdd-trigger:hover {
  background: var(--bg-hover, var(--bg-raised));
  color: var(--text-primary);
}

.fdd-trigger.has-active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}

.fdd-chevron {
  font-size: 9px;
  opacity: 0.6;
}

.fdd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
}

/* ── Dropdown panel ── */
.fdd-panel {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 0;
  min-width: 190px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.fdd-panel[hidden] {
  display: none;
}

.fdp-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s;
}

.fdp-option:hover {
  background: var(--bg-raised);
}

.fdp-option input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.fdp-select-all {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.fdp-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.fdp-clear-opt {
  color: var(--text-muted);
  font-style: italic;
}

.fdd-clear-all {
  margin-left: auto;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}

.fdd-clear-all:hover {
  color: var(--red, #f43f5e);
  border-color: var(--red, #f43f5e);
}

.filter-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  transition: var(--trans-md);
}

.filter-panel.hidden {
  display: none;
}

.filter-panel::-webkit-scrollbar {
  width: 3px;
}

.filter-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.filter-panel-header span {
  font-size: 13px;
  font-weight: 600;
}

.filter-section {
  margin-bottom: 18px;
}

.filter-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.type-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.status-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-pill {
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: var(--trans);
}

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

.filter-pill.active {
  background: var(--accent-bg);
  color: var(--accent-light);
  border-color: var(--border-accent);
}

.filter-pill-full {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  transition: var(--trans);
}

.filter-pill-full:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.filter-pill-full.active {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--border-accent);
}

.filter-search-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  margin-bottom: 6px;
}

.filter-search-input:focus {
  border-color: var(--border-focus);
}

.tag-filter-list {
  max-height: 140px;
  overflow-y: auto;
}

.tag-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--trans);
}

.tag-filter-item:hover {
  color: var(--text-primary);
  background: var(--border);
}

.tag-filter-item.active {
  color: var(--accent-light);
  background: var(--accent-bg);
}

.tag-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-logic-toggle {
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
}

.collection-filter-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.collection-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--trans);
}

.collection-filter-item:hover {
  color: var(--text-primary);
  background: var(--border);
}

.collection-filter-item.active {
  color: var(--accent-light);
  background: var(--accent-bg);
}

.rating-filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.star-btn {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 4px;
  border-radius: var(--radius-xs);
  transition: var(--trans);
}

.star-btn:hover {
  color: var(--amber);
  background: var(--amber-bg);
}

.star-btn.active {
  color: var(--amber);
  background: var(--amber-bg);
}

.date-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.library-results {
  flex: 1;
  min-width: 0;
}

.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.active-filter-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}

.active-filter-chip button {
  color: var(--accent-light);
  opacity: 0.7;
}

.active-filter-chip button:hover {
  opacity: 1;
}

.active-filters-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
  font-family: var(--font-display);
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 14px;
  margin-bottom: 24px;
}

/* ══════════════════════════════════════════════════
   PLAYLISTS
══════════════════════════════════════════════════ */
.playlist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--trans);
  cursor: pointer;
}

.playlist-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.playlist-cover {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
}

.playlist-card-body {
  padding: 14px;
}

.playlist-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.playlist-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.playlist-progress-wrap {
  margin-bottom: 8px;
}

.playlist-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.playlist-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  border-radius: 2px;
  transition: width 0.5s var(--ease);
}

.playlist-progress-text {
  font-size: 11px;
  color: var(--text-muted);
}

.playlist-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── PLAYLIST DETAIL SPLIT VIEW ── */
.playlist-detail-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

.playlist-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.playlist-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playlist-meta-header .playlist-detail-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.playlist-meta-header .playlist-detail-count {
  font-size: 12px;
  color: var(--text-muted);
}

.playlist-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.playlist-items-list::-webkit-scrollbar {
  width: 3px;
}

.playlist-items-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--trans);
  border: 1px solid transparent;
}

.playlist-item:hover {
  background: var(--bg-card);
}

.playlist-item.active {
  background: var(--accent-bg);
  border-color: var(--border-accent);
}

.playlist-item-num {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 20px;
  text-align: center;
}

.playlist-item-thumb {
  width: 56px;
  height: 40px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-raised);
}

.playlist-item-body {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.playlist-item-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.playlist-item-status {
  font-size: 16px;
  flex-shrink: 0;
}

.playlist-item .drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0;
}

.playlist-item:hover .drag-handle {
  opacity: 1;
}

.playlist-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.playlist-active-item {
  max-width: 800px;
  margin: 0 auto;
}

.playlist-video-embed {
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  margin-bottom: 20px;
}

.playlist-video-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.playlist-active-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.playlist-active-status {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.status-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: var(--trans);
}

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

.status-btn.active {
  background: var(--accent-bg);
  color: var(--accent-light);
  border-color: var(--border-accent);
}

.playlist-notes-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.playlist-notes-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.playlist-notes-input {
  width: 100%;
  min-height: 120px;
  background: none;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  resize: none;
  border: none;
  font-family: var(--font-body);
}

.playlist-notes-input::placeholder {
  color: var(--text-muted);
}

.playlist-takeaways-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.playlist-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   COLLECTIONS
══════════════════════════════════════════════════ */
.collection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--trans);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.collection-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.collection-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collection-icon {
  font-size: 24px;
}

.collection-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.collection-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.collection-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.collection-count {
  font-size: 12px;
  color: var(--text-muted);
}

.collection-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  margin-left: auto;
  transition: var(--trans);
}

.collection-card:hover .collection-actions {
  opacity: 1;
}

/* ══════════════════════════════════════════════════
   IMAGE BOARDS
══════════════════════════════════════════════════ */
.masonry-grid {
  column-count: 4;
  column-gap: 12px;
}

@media (max-width: 1400px) {
  .masonry-grid {
    column-count: 3;
  }
}

@media (max-width: 900px) {
  .masonry-grid {
    column-count: 2;
  }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--trans);
}

.masonry-item:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.masonry-item img {
  width: 100%;
  display: block;
}

.masonry-item-meta {
  padding: 8px 10px;
}

.masonry-item-title {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 2px;
}

.masonry-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.masonry-color-strip {
  height: 4px;
  display: flex;
}

.color-swatch {
  flex: 1;
}

/* ══════════════════════════════════════════════════
   DISCOVER
══════════════════════════════════════════════════ */
.discover-modes {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.discover-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--trans);
}

.discover-mode-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.discover-mode-btn.active {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--border-accent);
}

.discover-pane {
  display: none;
}

.discover-pane.active {
  display: block;
  animation: view-in 0.3s var(--ease) both;
}

.serendipity-card-wrap {
  max-width: 560px;
  margin: 0 auto 24px;
}

.serendipity-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timeline-day {
  display: flex;
  gap: 16px;
}

.timeline-date {
  width: 80px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 6px;
}

.timeline-items {
  flex: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════
   INSIGHTS
══════════════════════════════════════════════════ */
.insights-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  grid-auto-rows: min-content;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.insight-card.wide {
  grid-column: span 3;
}

.insight-card:last-child:not(.wide) {
  grid-column: span 1;
}

.insight-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.stats-list-label {
  color: var(--text-secondary);
}

.stats-list-val {
  font-weight: 600;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════
   SETTINGS
══════════════════════════════════════════════════ */
.settings-layout {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.settings-card.danger-zone {
  border-color: rgba(244, 63, 94, 0.2);
  background: rgba(244, 63, 94, 0.04);
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.settings-profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border-hover);
}

.settings-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.settings-email {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.settings-row label {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.settings-row-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.settings-row-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-bg-in 0.2s ease both;
}

@keyframes modal-bg-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.3s var(--ease) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(16px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── FORM ELEMENTS ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full {
  grid-column: span 2;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-label-sm {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.form-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: var(--trans);
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  appearance: none;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Rich Text Editor (Notes) ── */
.rte-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
  transition: border-color 0.15s;
}

.rte-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.rte-btn:hover {
  background: var(--surface-3, rgba(255, 255, 255, 0.06));
  color: var(--text-primary);
  border-color: var(--border);
}

.rte-btn svg {
  display: block;
  pointer-events: none;
}

.rte-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.rte-select {
  height: 26px;
  padding: 0 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  outline: none;
}

.rte-select:focus {
  border-color: var(--accent);
  color: var(--text-primary);
}

.rte-color-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  position: relative;
}

.rte-color-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 26px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background 0.12s;
}

.rte-color-wrap:hover .rte-color-icon {
  background: var(--surface-3, rgba(255, 255, 255, 0.06));
  border-color: var(--border);
  color: var(--text-primary);
}

.rte-highlight-icon {
  background: rgba(250, 204, 21, 0.25);
  color: #facc15;
}

.rte-color-input {
  position: absolute;
  opacity: 0;
  width: 22px;
  height: 26px;
  top: 0;
  left: 0;
  cursor: pointer;
  padding: 0;
  border: none;
}

.rte-editor {
  min-height: 80px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.65;
  outline: none;
  word-break: break-word;
}

.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.rte-editor ul,
.rte-editor ol {
  padding-left: 1.4em;
  margin: 4px 0;
}

.rte-editor li {
  margin: 2px 0;
}

/* Detail modal note editor — slightly taller */
#detail-note-editor.rte-editor {
  min-height: 120px;
  max-height: 400px;
}

.form-select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.input-lg {
  font-size: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
}

.select-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.select-sm:focus {
  border-color: var(--border-focus);
}

.form-label-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ── TAG INPUT ── */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 42px;
  cursor: text;
  transition: var(--trans);
}

.tag-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.tag-chip button {
  color: var(--accent-light);
  opacity: 0.7;
  font-size: 12px;
}

.tag-chip button:hover {
  opacity: 1;
}

.tag-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  flex: 1;
  min-width: 80px;
}

/* ── STAR RATING ── */
.star-rating-input {
  display: flex;
  gap: 2px;
}

.star-rate-btn {
  font-size: 22px;
  color: var(--border-hover);
  transition: var(--trans);
}

.star-rate-btn:hover,
.star-rate-btn.active {
  color: var(--amber);
  transform: scale(1.1);
}

/* ── URL PREVIEW ── */
.url-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.url-input-wrap .form-input {
  flex: 1;
}

.url-preview {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.url-preview-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}

.url-preview-thumb {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}

.url-type-badge,
.url-type-select {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  outline: none;
  background: #334155;
  color: #fff;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffffff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.url-preview-meta {
  flex: 1;
  min-width: 0;
}

.url-preview-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.url-preview-domain {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── YOUTUBE THUMB PICKER ── */
.yt-thumb-picker {
  margin-bottom: 12px;
}

.yt-thumb-picker-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.yt-thumbs-row {
  display: flex;
  gap: 8px;
}

.yt-thumb-option {
  width: 90px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--trans);
}

.yt-thumb-option.selected,
.yt-thumb-option:hover {
  border-color: var(--accent);
}

/* ── TIMESTAMP NOTES ── */
.timestamp-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.timestamp-time-input {
  width: 70px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.timestamp-note-input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

/* ── COLOR PALETTE PICKER ── */
.color-palette-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: var(--trans);
  cursor: pointer;
}

.color-swatch-btn.selected,
.color-swatch-btn:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ══════════════════════════════════════════════════
   CARD STUDIO
══════════════════════════════════════════════════ */
.studio-modal-card {
  max-width: 900px;
  width: 100%;
  max-height: 92vh;
}

.studio-layout {
  display: flex;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
  flex: 1;
}

.studio-preview-pane {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.studio-preview-wrap {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.studio-card-preview {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  width: 100%;
  transition: var(--trans-md);
  /* Size: standard default 3:2 */
  aspect-ratio: 3/2;
  background: var(--bg-card);
}

.studio-card-preview.size-compact {
  aspect-ratio: 1.55;
  max-width: 280px;
}

.studio-card-preview.size-standard {
  aspect-ratio: 1.5;
}

.studio-card-preview.size-wide {
  aspect-ratio: 2.33;
}

.studio-card-preview.size-portrait {
  aspect-ratio: 0.667;
  max-width: 180px;
}

.studio-card-preview.size-cinema {
  aspect-ratio: 16/9;
}

.studio-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: var(--trans-md);
}

.studio-overlay-layer {
  position: absolute;
  inset: 0;
}

.studio-text-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.studio-text-el {
  position: absolute;
  line-height: 1.25;
  max-width: 90%;
  cursor: pointer;
  pointer-events: all;
  transition: outline var(--trans);
}

.studio-text-el.selected {
  outline: 1px dashed var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.studio-size-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.size-pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: var(--trans);
  cursor: pointer;
}

.size-pill.active,
.size-pill:hover {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--border-accent);
}

.studio-preview-actions {
  display: flex;
  gap: 8px;
}

.studio-controls-pane {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.studio-controls-pane::-webkit-scrollbar {
  width: 3px;
}

.studio-controls-pane::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

.studio-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.studio-section:last-child {
  border-bottom: none;
}

.studio-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.studio-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.range-val {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 32px;
  text-align: right;
}

.bg-source-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bg-tab {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: var(--trans);
  cursor: pointer;
}

.bg-tab.active,
.bg-tab:hover {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--border-accent);
}

.bg-source-pane {
  display: none;
}

.bg-source-pane.active {
  display: block;
}

.yt-studio-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.yt-studio-thumb {
  width: 80px;
  height: 50px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--trans);
}

.yt-studio-thumb:hover,
.yt-studio-thumb.selected {
  border-color: var(--accent);
}

.unsplash-search-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.unsplash-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.unsplash-result-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--trans);
}

.unsplash-result-img:hover {
  border-color: var(--accent);
}

.gradient-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

.gradient-preset-btn {
  height: 30px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--trans);
}

.gradient-preset-btn:hover,
.gradient-preset-btn.selected {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.gradient-custom {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overlay-types {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.overlay-type-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: var(--trans);
  cursor: pointer;
}

.overlay-type-btn.active,
.overlay-type-btn:hover {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--border-accent);
}

.text-elements-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-el-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--trans);
}

.text-el-item:hover {
  border-color: var(--border-hover);
}

.text-el-item.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.text-el-preview {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-el-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.preset-btn {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--trans);
  background: var(--bg-raised);
  color: var(--text-secondary);
}

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

/* Text Element Editor Panel */
.text-element-editor {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-modal);
  border-left: 1px solid var(--border-hover);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow-y: auto;
  animation: slide-from-right 0.25s var(--ease) both;
}

@keyframes slide-from-right {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(0);
  }
}

.tee-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.tee-title {
  font-size: 13px;
  font-weight: 600;
}

.tee-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ══════════════════════════════════════════════════
   TEXT EFFECT CLASSES — Card Studio
══════════════════════════════════════════════════ */
.fx-cinematic {
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 4px 16px rgba(0, 0, 0, 0.7),
    0 12px 40px rgba(0, 0, 0, 0.5);
}

.fx-neon-glow {
  text-shadow:
    0 0 6px currentColor,
    0 0 20px currentColor,
    0 0 50px currentColor;
}

.fx-editorial {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  -webkit-text-stroke: 0.5px currentColor;
}

.fx-embossed {
  text-shadow:
    -1px -1px 2px rgba(255, 255, 255, 0.25),
    1px 1px 3px rgba(0, 0, 0, 0.9),
    2px 2px 6px rgba(0, 0, 0, 0.7);
}

.fx-frosted {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.fx-rising-mist {
  opacity: 0.65;
  filter: blur(0.6px);
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.fx-gold-leaf {
  background: linear-gradient(135deg, #b8860b 0%, #ffd700 35%, #ffe87c 50%, #ffd700 65%, #b8860b 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fx-deep-shadow {
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 1),
    0 4px 10px rgba(0, 0, 0, 0.9),
    0 8px 24px rgba(0, 0, 0, 0.8),
    0 20px 50px rgba(0, 0, 0, 0.6);
}

.fx-ghost {
  opacity: 0.28;
}

.fx-outlined {
  -webkit-text-stroke: 1.5px currentColor;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.fx-holographic {
  background: linear-gradient(90deg, #ff00ff, #ff8800, #00ffff, #8800ff, #ff00ff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holo-shift 3s linear infinite;
}

@keyframes holo-shift {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 300% 50%;
  }
}

/* ── ENTRANCE ANIMATIONS ── */
@keyframes rise-up {
  from {
    opacity: 0;
    transform: translateY(36px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise-blur {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes drift-l {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes drift-r {
  from {
    opacity: 0;
    transform: translateX(36px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fall-in {
  from {
    opacity: 0;
    transform: translateY(-36px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zoom-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes unblur {
  from {
    filter: blur(14px);
    opacity: 0.5;
  }

  to {
    filter: blur(0);
    opacity: 1;
  }
}

@keyframes reveal-up {
  from {
    clip-path: inset(100% 0 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-8px)
  }
}

@keyframes pulse-gl {

  0%,
  100% {
    text-shadow: 0 0 8px currentColor
  }

  50% {
    text-shadow: 0 0 28px currentColor, 0 0 56px currentColor
  }
}

.anim-rise-up {
  animation: rise-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-rise-blur {
  animation: rise-blur 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-drift-l {
  animation: drift-l 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-drift-r {
  animation: drift-r 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-fall-in {
  animation: fall-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-zoom-in {
  animation: zoom-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-unblur {
  animation: unblur 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-reveal-up {
  animation: reveal-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-float {
  animation: float 3s ease-in-out infinite;
}

.anim-pulse-gl {
  animation: pulse-gl 2.5s ease-in-out infinite;
}

.anim-holo {
  animation: holo-shift 3s linear infinite;
}

/* ══════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════ */
.lightbox-card {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-lg);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: #fff;
}

.lightbox-meta {
  margin-top: 12px;
  color: #fff;
  font-size: 13px;
  text-align: center;
}

/* ══════════════════════════════════════════════════
   LINK DETAIL MODAL BODY
══════════════════════════════════════════════════ */
.detail-video-embed {
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  margin-bottom: 20px;
}

.detail-video-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.detail-image-preview {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.detail-meta-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.detail-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-meta-val {
  font-size: 13px;
  font-weight: 600;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.detail-note-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.detail-note-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.detail-timestamps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-ts-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.detail-ts-time {
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xs);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.detail-ts-note {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════════════ */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-hover);
  cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-modal);
  cursor: pointer;
}

input[type=range]:focus {
  outline: none;
}

input[type=color] {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  cursor: pointer;
  padding: 2px;
}

.confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-card) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shine {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Scrollbar global */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .insight-card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: 70px;
    /* room for bottom nav */
  }

  /* Sidebar becomes a fixed overlay drawer on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    z-index: 300;
    transition: left var(--trans-md);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .view {
    padding: 16px 14px;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-search-wrap {
    display: none;
  }

  .topbar-actions .btn-secondary,
  .topbar-actions .btn-theme-toggle {
    display: none;
  }

  .topbar-actions #add-link-btn {
    display: none;
    /* using FAB on mobile */
  }

  .view-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
  }

  .view-header-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-value {
    font-size: 26px;
  }

  /* Cards: single column on mobile */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cards-grid.three-col {
    grid-template-columns: 1fr;
  }

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

  .form-group.full {
    grid-column: span 1;
  }

  .studio-layout {
    flex-direction: column;
  }

  .studio-preview-pane {
    width: 100%;
  }

  .playlist-detail-layout {
    flex-direction: column;
  }

  .playlist-sidebar {
    width: 100%;
    height: 300px;
    overflow-y: auto;
  }

  .section-title {
    font-size: 16px;
  }

  .view-title {
    font-size: 22px;
  }

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

  .insight-card.wide {
    grid-column: span 1;
  }

  /* Modal full-screen on mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100% !important;
  }

  /* Search visible in mobile: override topbar hidden */
  .topbar-search-mobile-row {
    display: flex;
  }
}

/* ── TYPE BADGE COLORS ── */
.type-youtube {
  background: #dc2626;
  color: #fff;
}

.type-article {
  background: #2563eb;
  color: #fff;
}

.type-website {
  background: #059669;
  color: #fff;
}

.type-image {
  background: #ea580c;
  color: #fff;
}

.type-tool {
  background: #7c3aed;
  color: #fff;
}

.type-github {
  background: #334155;
  color: #e2e8f0;
}

.type-course {
  background: #d97706;
  color: #fff;
}

.type-book {
  background: #0f766e;
  color: #fff;
}

.type-reddit {
  background: #c2410c;
  color: #fff;
}

.type-twitter {
  background: #0284c7;
  color: #fff;
}

.type-other {
  background: #4b5563;
  color: #fff;
}

/* ── STATUS COLORS ── */
.status-unread {
  background: var(--text-muted);
}

.status-reading {
  background: var(--blue);
}

.status-done {
  background: var(--green);
}

.status-revisit {
  background: var(--accent);
}

/* ── PRIORITY COLORS ── */
.priority-high {
  color: var(--rose);
}

.priority-medium {
  color: var(--amber);
}

.priority-low {
  color: var(--teal);
}

.priority-must-watch {
  color: var(--amber);
}

/* ══════════════════════════════════════════════════
   THEME BUTTON + PANEL
══════════════════════════════════════════════════ */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--trans);
  cursor: pointer;
  white-space: nowrap;
}

.btn-theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.theme-toggle-icon {
  font-size: 15px;
  line-height: 1;
}

.theme-panel {
  position: absolute;
  top: var(--topbar-h);
  right: 0;
  left: 0;
  z-index: 200;
  background: var(--bg-modal);
  border-bottom: 1px solid var(--border-hover);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  animation: theme-panel-in 0.25s var(--ease) both;
  backdrop-filter: blur(20px);
}

@keyframes theme-panel-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.theme-panel-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 28px 22px;
}

.theme-section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.theme-section-icon {
  font-size: 14px;
}

.theme-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: var(--trans);
}

.theme-swatch:hover {
  transform: translateY(-3px);
}

.theme-swatch.active .theme-swatch-preview {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.theme-swatch-preview {
  width: 72px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: 1fr 1fr;
  transition: var(--trans);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.theme-swatch-sidebar {
  grid-row: span 2;
}

.theme-swatch-topbar {}

.theme-swatch-content {}

.theme-swatch-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  max-width: 72px;
}

.theme-swatch.active .theme-swatch-label {
  color: var(--accent-light);
}

/* ══════════════════════════════════════════════════
   DARK THEMES (5)
══════════════════════════════════════════════════ */

/* 1. VOID — default, already set in :root */
[data-theme="void"] {
  --bg-deep: #08080f;
  --bg-base: #0d0d1a;
  --bg-raised: #121220;
  --bg-card: #16162a;
  --bg-card-hover: #1c1c34;
  --bg-input: #1a1a2e;
  --bg-modal: #0f0f1e;
  --bg-sidebar: #0b0b17;
  --bg-topbar: rgba(8, 8, 15, 0.88);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #f0f0f8;
  --text-secondary: #8888a8;
  --text-muted: #555570;
  --accent: #8b5cf6;
  --accent-hover: #9d71f8;
  --accent-light: #a78bfa;
  --accent-bg: rgba(139, 92, 246, 0.12);
  --accent-glow: rgba(139, 92, 246, 0.25);
  --teal: #06d6a0;
}

/* 2. MIDNIGHT FOREST */
[data-theme="midnight-forest"] {
  --bg-deep: #030a05;
  --bg-base: #071208;
  --bg-raised: #0c1c0e;
  --bg-card: #112414;
  --bg-card-hover: #162e19;
  --bg-input: #122016;
  --bg-modal: #0a1a0c;
  --bg-sidebar: #060f07;
  --bg-topbar: rgba(3, 10, 5, 0.9);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.13);
  --text-primary: #e8f5e9;
  --text-secondary: #7a9e7e;
  --text-muted: #3d6642;
  --accent: #22c55e;
  --accent-hover: #34d974;
  --accent-light: #4ade80;
  --accent-bg: rgba(34, 197, 94, 0.12);
  --accent-glow: rgba(34, 197, 94, 0.2);
  --border-focus: rgba(34, 197, 94, 0.6);
  --border-accent: rgba(34, 197, 94, 0.3);
  --teal: #06d6a0;
}

/* 3. ECLIPSE */
[data-theme="eclipse"] {
  --bg-deep: #02040e;
  --bg-base: #060c1e;
  --bg-raised: #0c1430;
  --bg-card: #101a38;
  --bg-card-hover: #162040;
  --bg-input: #101830;
  --bg-modal: #080f22;
  --bg-sidebar: #050a18;
  --bg-topbar: rgba(2, 4, 14, 0.9);
  --border: rgba(59, 130, 246, 0.1);
  --border-hover: rgba(59, 130, 246, 0.2);
  --text-primary: #e8eeff;
  --text-secondary: #6e88cc;
  --text-muted: #364a7a;
  --accent: #3b82f6;
  --accent-hover: #5592f8;
  --accent-light: #60a5fa;
  --accent-bg: rgba(59, 130, 246, 0.12);
  --accent-glow: rgba(59, 130, 246, 0.22);
  --border-focus: rgba(59, 130, 246, 0.6);
  --border-accent: rgba(59, 130, 246, 0.3);
  --teal: #38bdf8;
}

/* 4. OBSIDIAN */
[data-theme="obsidian"] {
  --bg-deep: #080808;
  --bg-base: #111111;
  --bg-raised: #1a1a1a;
  --bg-card: #1f1f1f;
  --bg-card-hover: #262626;
  --bg-input: #1c1c1c;
  --bg-modal: #141414;
  --bg-sidebar: #0d0d0d;
  --bg-topbar: rgba(8, 8, 8, 0.92);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text-primary: #f5f5f5;
  --text-secondary: #909090;
  --text-muted: #555555;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-light: #fcd34d;
  --accent-bg: rgba(245, 158, 11, 0.1);
  --accent-glow: rgba(245, 158, 11, 0.2);
  --border-focus: rgba(245, 158, 11, 0.5);
  --border-accent: rgba(245, 158, 11, 0.25);
  --teal: #34d399;
}

/* 5. BLOOD MOON */
[data-theme="blood-moon"] {
  --bg-deep: #0e0505;
  --bg-base: #170808;
  --bg-raised: #210c0c;
  --bg-card: #2a1010;
  --bg-card-hover: #321515;
  --bg-input: #241010;
  --bg-modal: #1a0808;
  --bg-sidebar: #120606;
  --bg-topbar: rgba(14, 5, 5, 0.9);
  --border: rgba(244, 63, 94, 0.1);
  --border-hover: rgba(244, 63, 94, 0.2);
  --text-primary: #ffeaea;
  --text-secondary: #a06060;
  --text-muted: #6a3535;
  --accent: #f43f5e;
  --accent-hover: #f75d78;
  --accent-light: #fb7185;
  --accent-bg: rgba(244, 63, 94, 0.12);
  --accent-glow: rgba(244, 63, 94, 0.22);
  --border-focus: rgba(244, 63, 94, 0.6);
  --border-accent: rgba(244, 63, 94, 0.3);
  --teal: #f97316;
}

/* ══════════════════════════════════════════════════
   LIGHT THEMES (10)
══════════════════════════════════════════════════ */

/* SHARED LIGHT BASE — dark text, light backgrounds */
[data-theme^="light-"] {
  color-scheme: light;
  --text-primary: #1a1a2e;
  --text-secondary: #555575;
  --text-muted: #9090b0;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.14);
  --rose: #e11d48;
  --rose-bg: rgba(225, 29, 72, 0.08);
  --green: #16a34a;
  --blue: #2563eb;
}

/* SCROLLBAR for light themes */
[data-theme^="light-"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

/* 1. IVORY */
[data-theme="light-ivory"] {
  --bg-deep: #faf8f4;
  --bg-base: #f5f2ec;
  --bg-raised: #eeeae0;
  --bg-card: #fffef9;
  --bg-card-hover: #f7f5ef;
  --bg-input: #f0ede5;
  --bg-modal: #fefdf9;
  --bg-sidebar: #f0ede4;
  --bg-topbar: rgba(250, 248, 244, 0.92);
  --text-primary: #1a1208;
  --text-secondary: #5a4a30;
  --text-muted: #9a8a70;
  --border: rgba(80, 60, 20, 0.1);
  --border-hover: rgba(80, 60, 20, 0.18);
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-light: #6d28d9;
  --accent-bg: rgba(139, 92, 246, 0.08);
  --accent-glow: rgba(139, 92, 246, 0.15);
  --border-focus: rgba(139, 92, 246, 0.5);
  --border-accent: rgba(139, 92, 246, 0.25);
  --teal: #0d9488;
  --amber: #b45309;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* 2. ARCTIC */
[data-theme="light-arctic"] {
  --bg-deep: #f0f5fc;
  --bg-base: #e8f0f9;
  --bg-raised: #dce8f5;
  --bg-card: #f8faff;
  --bg-card-hover: #eef4fc;
  --bg-input: #e4edf8;
  --bg-modal: #f5f9ff;
  --bg-sidebar: #dce8f5;
  --bg-topbar: rgba(240, 245, 252, 0.92);
  --text-primary: #0a1828;
  --text-secondary: #2a4a6a;
  --text-muted: #6a90b0;
  --border: rgba(30, 80, 140, 0.1);
  --border-hover: rgba(30, 80, 140, 0.18);
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-light: #0369a1;
  --accent-bg: rgba(14, 165, 233, 0.08);
  --accent-glow: rgba(14, 165, 233, 0.18);
  --border-focus: rgba(14, 165, 233, 0.5);
  --border-accent: rgba(14, 165, 233, 0.25);
  --teal: #0891b2;
  --amber: #b45309;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* 3. PARCHMENT */
[data-theme="light-parchment"] {
  --bg-deep: #fdf6e3;
  --bg-base: #f9eed0;
  --bg-raised: #f2e4bc;
  --bg-card: #fffdf5;
  --bg-card-hover: #f8f2de;
  --bg-input: #f3e9cc;
  --bg-modal: #fefcf0;
  --bg-sidebar: #f0e5c4;
  --bg-topbar: rgba(253, 246, 227, 0.92);
  --text-primary: #2d1a00;
  --text-secondary: #7a5c28;
  --text-muted: #aa8854;
  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-light: #78350f;
  --accent-bg: rgba(180, 83, 9, 0.08);
  --accent-glow: rgba(180, 83, 9, 0.15);
  --border-focus: rgba(180, 83, 9, 0.5);
  --border-accent: rgba(180, 83, 9, 0.25);
  --teal: #047857;
  --amber: #92400e;
  --border: rgba(120, 80, 20, 0.1);
  --border-hover: rgba(120, 80, 20, 0.18);
}

/* 4. ROSE QUARTZ */
[data-theme="light-rose"] {
  --bg-deep: #fdf2f5;
  --bg-base: #fce7ee;
  --bg-raised: #f9d7e3;
  --bg-card: #fff8fa;
  --bg-card-hover: #fceef3;
  --bg-input: #f8dce8;
  --bg-modal: #fef6f8;
  --bg-sidebar: #f8d7e4;
  --bg-topbar: rgba(253, 242, 245, 0.92);
  --text-primary: #3d0a18;
  --text-secondary: #8a4055;
  --text-muted: #c08090;
  --accent: #e11d48;
  --accent-hover: #be123c;
  --accent-light: #9f1239;
  --accent-bg: rgba(225, 29, 72, 0.08);
  --accent-glow: rgba(225, 29, 72, 0.15);
  --border-focus: rgba(225, 29, 72, 0.5);
  --border-accent: rgba(225, 29, 72, 0.25);
  --teal: #0f766e;
  --amber: #b45309;
  --border: rgba(180, 60, 90, 0.1);
  --border-hover: rgba(180, 60, 90, 0.18);
}

/* 5. MINT FRESH */
[data-theme="light-mint"] {
  --bg-deep: #f0faf5;
  --bg-base: #e4f5ec;
  --bg-raised: #d0eddc;
  --bg-card: #f7fdf9;
  --bg-card-hover: #edf9f2;
  --bg-input: #d8eee1;
  --bg-modal: #f4fcf7;
  --bg-sidebar: #d4ecdd;
  --bg-topbar: rgba(240, 250, 245, 0.92);
  --text-primary: #062613;
  --text-secondary: #2d6645;
  --text-muted: #72a888;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: #065f46;
  --accent-bg: rgba(5, 150, 105, 0.08);
  --accent-glow: rgba(5, 150, 105, 0.15);
  --border-focus: rgba(5, 150, 105, 0.5);
  --border-accent: rgba(5, 150, 105, 0.25);
  --teal: #0891b2;
  --amber: #b45309;
  --border: rgba(20, 120, 60, 0.1);
  --border-hover: rgba(20, 120, 60, 0.18);
}

/* 6. LAVENDER */
[data-theme="light-lavender"] {
  --bg-deep: #f5f0ff;
  --bg-base: #ede5ff;
  --bg-raised: #e0d4ff;
  --bg-card: #faf7ff;
  --bg-card-hover: #f2ecff;
  --bg-input: #e6daff;
  --bg-modal: #f7f3ff;
  --bg-sidebar: #dfd3ff;
  --bg-topbar: rgba(245, 240, 255, 0.92);
  --text-primary: #1e0a3c;
  --text-secondary: #5a3a8a;
  --text-muted: #9878c0;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: #5b21b6;
  --accent-bg: rgba(124, 58, 237, 0.08);
  --accent-glow: rgba(124, 58, 237, 0.15);
  --border-focus: rgba(124, 58, 237, 0.5);
  --border-accent: rgba(124, 58, 237, 0.25);
  --teal: #0f766e;
  --amber: #b45309;
  --border: rgba(100, 50, 180, 0.1);
  --border-hover: rgba(100, 50, 180, 0.18);
}

/* 7. CLOUD */
[data-theme="light-cloud"] {
  --bg-deep: #ffffff;
  --bg-base: #f8f9fb;
  --bg-raised: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f6f8;
  --bg-input: #f0f2f5;
  --bg-modal: #ffffff;
  --bg-sidebar: #f0f2f5;
  --bg-topbar: rgba(255, 255, 255, 0.94);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #4338ca;
  --accent-bg: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-accent: rgba(99, 102, 241, 0.25);
  --teal: #0891b2;
  --amber: #b45309;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
}

/* 8. PEACH BLOSSOM */
[data-theme="light-peach"] {
  --bg-deep: #fff8f3;
  --bg-base: #feeee3;
  --bg-raised: #fde0cc;
  --bg-card: #fffaf7;
  --bg-card-hover: #fdf0e6;
  --bg-input: #fde4d0;
  --bg-modal: #fff8f5;
  --bg-sidebar: #fcdfc8;
  --bg-topbar: rgba(255, 248, 243, 0.92);
  --text-primary: #2c0e00;
  --text-secondary: #8a4520;
  --text-muted: #c0855a;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-light: #9a3412;
  --accent-bg: rgba(234, 88, 12, 0.08);
  --accent-glow: rgba(234, 88, 12, 0.15);
  --border-focus: rgba(234, 88, 12, 0.5);
  --border-accent: rgba(234, 88, 12, 0.25);
  --teal: #0f766e;
  --amber: #92400e;
  --border: rgba(180, 80, 20, 0.1);
  --border-hover: rgba(180, 80, 20, 0.18);
}

/* 9. OCEAN MIST */
[data-theme="light-ocean"] {
  --bg-deep: #f0f6fa;
  --bg-base: #e2eef5;
  --bg-raised: #cfe0ed;
  --bg-card: #f5f9fc;
  --bg-card-hover: #e8f2f8;
  --bg-input: #d8e8f2;
  --bg-modal: #f2f8fc;
  --bg-sidebar: #ccdde8;
  --bg-topbar: rgba(240, 246, 250, 0.92);
  --text-primary: #062030;
  --text-secondary: #2a5a72;
  --text-muted: #6a9aaa;
  --accent: #0369a1;
  --accent-hover: #075985;
  --accent-light: #0c4a6e;
  --accent-bg: rgba(3, 105, 161, 0.08);
  --accent-glow: rgba(3, 105, 161, 0.15);
  --border-focus: rgba(3, 105, 161, 0.5);
  --border-accent: rgba(3, 105, 161, 0.25);
  --teal: #0e7490;
  --amber: #b45309;
  --border: rgba(0, 80, 120, 0.1);
  --border-hover: rgba(0, 80, 120, 0.18);
}

/* 10. SAGE */
[data-theme="light-sage"] {
  --bg-deep: #f3f5f0;
  --bg-base: #e8ece2;
  --bg-raised: #d8ded0;
  --bg-card: #f8faf5;
  --bg-card-hover: #edf0e8;
  --bg-input: #dce2d4;
  --bg-modal: #f5f7f2;
  --bg-sidebar: #d5dcc8;
  --bg-topbar: rgba(243, 245, 240, 0.92);
  --text-primary: #1a2015;
  --text-secondary: #4a6040;
  --text-muted: #88a075;
  --accent: #4d7c0f;
  --accent-hover: #3f6212;
  --accent-light: #365314;
  --accent-bg: rgba(77, 124, 15, 0.08);
  --accent-glow: rgba(77, 124, 15, 0.15);
  --border-focus: rgba(77, 124, 15, 0.5);
  --border-accent: rgba(77, 124, 15, 0.25);
  --teal: #0f766e;
  --amber: #92400e;
  --border: rgba(40, 80, 20, 0.1);
  --border-hover: rgba(40, 80, 20, 0.18);
}

/* ── Fix light theme specifics ── */
[data-theme^="light-"] .auth-grid-lines {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

[data-theme^="light-"] .card-thumb-placeholder {
  color: var(--text-muted);
}

[data-theme^="light-"] .link-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme^="light-"] .modal-card {
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme^="light-"] .topbar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme^="light-"] .sidebar {
  border-right-color: rgba(0, 0, 0, 0.08);
}

[data-theme^="light-"] .btn-google-signin {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

[data-theme^="light-"] .nav-item.active {
  color: var(--accent);
}

[data-theme^="light-"] .stat-card.accent .stat-value {
  color: var(--accent);
}

[data-theme^="light-"] .stat-card.teal .stat-value {
  color: var(--teal);
}

[data-theme^="light-"] .stat-card.amber .stat-value {
  color: var(--amber);
}

[data-theme^="light-"] .theme-swatch-preview {
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme^="light-"] .btn-theme-toggle {
  background: var(--bg-raised);
}

[data-theme^="light-"] input[type=range]::-webkit-slider-thumb {
  border-color: var(--bg-card);
}

[data-theme^="light-"] .filter-pill {
  background: var(--bg-raised);
}

[data-theme^="light-"] .gradient-preset-btn {
  border-color: rgba(0, 0, 0, 0.1);
}

/* ══════════════════════════════════════════════════
   QUICK CARD STYLE (Add Link modal)
══════════════════════════════════════════════════ */
.quick-card-style {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qcs-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
}

.qcs-bg-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qcs-color-swatches {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.qcs-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--trans);
  flex-shrink: 0;
}

.qcs-swatch:hover {
  transform: scale(1.15);
}

.qcs-swatch.selected {
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--accent);
}

.qcs-clear-btn {
  color: var(--text-muted);
  font-size: 12px;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  transition: var(--trans);
  flex-shrink: 0;
}

.qcs-clear-btn:hover {
  color: var(--rose);
  border-color: var(--rose);
}

.qcs-img-row,
.qcs-text-row {
  display: flex;
  gap: 8px;
}

.qcs-text-row .form-input {
  flex: 1;
}

.qcs-preview-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.qcs-preview {
  width: 100%;
  aspect-ratio: 3/2;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  background: var(--bg-card);
}

.qcs-preview-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.qcs-preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 60%);
}

.qcs-preview-text {
  position: relative;
  z-index: 2;
  padding: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ══════════════════════════════════════════════════
   SETTINGS — CATEGORIES + TYPOGRAPHY
══════════════════════════════════════════════════ */
.settings-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* ── Layout Font Size (LFS) settings controls ── */
.lfs-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 300px;
}

.lfs-range {
  flex: 1;
  accent-color: var(--accent);
  min-width: 0;
}

.lfs-num {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-primary);
  font-size: 13px;
  text-align: center;
  -moz-appearance: textfield;
}

.lfs-num::-webkit-inner-spin-button,
.lfs-num::-webkit-outer-spin-button {
  opacity: 1;
}

.lfs-unit {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.settings-categories-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.settings-category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.settings-category-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-category-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
}

.settings-category-del {
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: var(--trans);
}

.settings-category-del:hover {
  color: var(--rose);
  background: var(--rose-bg);
}

.settings-add-category-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-add-category-row .form-input {
  flex: 1;
}

/* ── Badge color settings ── */
.badge-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.badge-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.badge-color-row .bcp-preview {
  position: static;
  flex: 1;
  pointer-events: none;
  font-size: 11px;
}

.badge-color-row input[type="color"] {
  width: 30px;
  height: 30px;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  background: transparent;
}

/* ── Table icon preview swatch ── */
.tbl-icon-preview {
  width: 38px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Section Typography settings ── */
.section-style-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
}

.ss-row {
  display: grid;
  grid-template-columns: 130px 32px 28px 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.ss-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.ss-color-input {
  width: 30px;
  height: 26px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  padding: 1px;
  cursor: pointer;
  background: transparent;
}

.ss-toggle {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text-muted);
}

.ss-toggle input {
  display: none;
}

.ss-toggle:has(input:checked) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ss-preview {
  font-size: 13px;
  padding-left: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 1;
}

.font-preview-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  flex: 1;
  text-align: right;
  transition: font-family 0.3s ease;
}

/* Category badge on cards */
.card-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.card-category-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Collection badge on dark note cards — raised surface override for visibility */
.note-card .card-collection-badge {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(200, 140, 30, 0.28);
}

/* Filter panel: category filters */
.category-filter-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.category-filter-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--trans);
}

.category-filter-item:hover {
  color: var(--text-primary);
  background: var(--border);
}

.category-filter-item.active {
  color: var(--accent-light);
  background: var(--accent-bg);
}

/* ══════════════════════════════════════════════════
   ICON.PNG LOGO STYLES
══════════════════════════════════════════════════ */
.auth-icon-img {
  border-radius: 10px;
  object-fit: cover;
}

.sidebar-icon-img {
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   MOBILE HAMBURGER & BRAND
══════════════════════════════════════════════════ */
.mobile-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: var(--trans);
}

.mobile-hamburger:hover {
  background: var(--border);
  color: var(--text-primary);
}

.mobile-topbar-brand {
  display: none;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #a78bfa, #06d6a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  flex: 1;
}

.mobile-brand-icon {
  border-radius: 5px;
  object-fit: cover;
}

@media (max-width: 768px) {
  .mobile-hamburger {
    display: flex;
  }

  .mobile-topbar-brand {
    display: flex;
  }
}

/* ══════════════════════════════════════════════════
   MOBILE SIDEBAR BACKDROP
══════════════════════════════════════════════════ */
.mobile-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 299;
  backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION
══════════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }
}

.mbn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--trans);
  flex: 1;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.mbn-item:hover,
.mbn-item.active {
  color: var(--accent-light);
}

.mbn-item.active {
  color: var(--accent-light);
}

/* FAB add button in centre */
.mbn-fab {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  padding: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-10px);
  transition: var(--trans);
  flex-direction: row;
  border: 3px solid var(--bg-sidebar);
}

.mbn-fab:hover {
  background: var(--accent-hover);
  transform: translateY(-12px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.mbn-fab span {
  display: none;
  /* no label for FAB */
}

/* ══════════════════════════════════════════════════
   ADD LINK MODAL — COLLAPSED / EXPANDED
══════════════════════════════════════════════════ */
.add-link-modal-body {
  padding: 16px 20px 0;
}

.add-link-essentials {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-link-title-row {
  margin-bottom: 0;
}

.add-link-expand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 2px;
}

.add-link-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--trans);
  cursor: pointer;
  flex-shrink: 0;
}

.add-link-expand-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.add-link-expand-btn[aria-expanded="true"] {
  background: var(--accent-bg);
  border-color: var(--border-accent);
  color: var(--accent-light);
}

.expand-triangle {
  font-size: 9px;
  transition: transform 0.25s var(--ease);
  line-height: 1;
  display: inline-block;
}

.add-link-expand-btn[aria-expanded="true"] .expand-triangle {
  transform: rotate(90deg);
}

.expand-divider {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.add-link-advanced {
  overflow: hidden;
  transition: none;
}

.add-link-advanced.expanding {
  animation: expand-in 0.28s var(--ease) both;
}

@keyframes expand-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════════════════
   DEFAULT CARD BACKGROUND COLORS — SETTINGS
══════════════════════════════════════════════════ */
.default-card-color-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.default-color-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  transition: var(--trans);
  cursor: default;
}

.default-color-row:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
}

.dcr-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.default-color-input {
  font-size: 12px !important;
  padding: 5px 8px !important;
  height: 30px;
  width: 130px;
}

.default-color-picker {
  width: 30px;
  height: 30px;
  cursor: pointer;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xs);
  padding: 2px;
  background: var(--bg-input);
}

/* ══════════════════════════════════════════════════
   MOBILE CARD LAYOUT IMPROVEMENTS
══════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Card visual improvements on mobile */
  .link-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  /* Stats cards equal size on mobile */
  .stat-card {
    border-radius: var(--radius-md);
  }

  /* Search in topbar hidden; add a small search bar below topbar on mobile */
  .topbar {
    height: 52px;
  }

  /* Section headers tighter on mobile */
  .section-block {
    margin-bottom: 24px;
  }

  /* Settings nice on mobile */
  .settings-layout {
    gap: 14px;
  }

  .settings-card {
    padding: 16px;
  }

  /* Default color grid responsive */
  .default-color-row {
    grid-template-columns: 1fr auto;
  }

  .default-color-input {
    display: none;
    /* hide text input on mobile, picker suffices */
  }

  /* Filter panel hidden on mobile by default */
  .filter-panel {
    display: none;
  }

  /* Cards rail scrollable */
  .cards-rail .link-card {
    flex: 0 0 260px;
  }

  /* Bottom nav safe area on iOS */
  .app-shell {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* Discover modes wrap */
  .discover-modes {
    flex-wrap: wrap;
    gap: 6px;
  }

  .discover-mode-btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
    font-size: 13px;
    padding: 9px 12px;
  }

  /* Add link modal essentials */
  .add-link-modal-body {
    padding: 14px 16px 0;
  }
}

/* ══════════════════════════════════════════════════
   MOBILE-ONLY SEARCH ROW (below topbar)
══════════════════════════════════════════════════ */
.mobile-search-row {
  display: none;
}

@media (max-width: 768px) {
  .mobile-search-row {
    display: flex;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-topbar);
    position: sticky;
    top: 52px;
    z-index: 49;
  }

  .mobile-search-row .topbar-search-wrap {
    display: flex;
    flex: 1;
  }
}

/* ══════════════════════════════════════════════════
   ADD LINK / NOTE MODE TOGGLE
══════════════════════════════════════════════════ */
.add-mode-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
}

.mode-tab {
  padding: 4px 14px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mode-tab.active {
  background: var(--accent);
  color: #fff;
}

.mode-tab:not(.active):hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════
   NOTE MODE TOP EDITOR
══════════════════════════════════════════════════ */
#note-mode-top {
  margin-bottom: 14px;
}

#note-mode-top .rte-editor {
  min-height: 200px;
  border-radius: 0 0 10px 10px;
}

/* ══════════════════════════════════════════════════
   NOTE CARD (library)
══════════════════════════════════════════════════ */
.note-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  background: linear-gradient(145deg, #1e1204 0%, #2c1a06 45%, #12100a 100%);
  border: 1px solid rgba(200, 140, 30, 0.18);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 220, 100, 0.06);
  min-height: 170px;
  display: flex;
  flex-direction: column;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 220, 100, 0.1);
  border-color: rgba(200, 140, 30, 0.35);
}

.note-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 36px 10px 6px;
}

.note-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(200, 140, 30, 0.15);
  border: 1px solid rgba(200, 140, 30, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.note-card-body {
  flex: 1;
  padding: 4px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.note-card-title {
  font-size: var(--cfs-grid, 14px);
  font-weight: 700;
  color: #f0d9a8;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-snippet {
  font-size: 12px;
  color: rgba(240, 217, 168, 0.5);
  line-height: 1.6;
  max-height: 4.8em;
  /* ~3 lines */
  overflow: hidden;
  word-break: break-word;
}

/* Strip large headings / margins inside rendered note HTML on card */
.note-card-snippet h1,
.note-card-snippet h2,
.note-card-snippet h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.note-card-snippet p {
  margin: 0 0 2px;
}

.note-card-snippet ul,
.note-card-snippet ol {
  padding-left: 1.2em;
  margin: 0;
}

.note-card-snippet br+br {
  display: none;
}

.note-card-snippet.note-empty {
  font-style: italic;
  color: rgba(240, 217, 168, 0.3);
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 12px;
  border-top: 1px solid rgba(200, 140, 30, 0.1);
  margin-top: auto;
}

.note-card-meta {
  font-size: 10px;
  letter-spacing: 0.4px;
  color: rgba(240, 217, 168, 0.3);
}

/* Note badge color */
.card-type-badge.type-note {
  background: #92400e;
}

/* ══════════════════════════════════════════════════
   PROMINENT NOTE DISPLAY (detail modal)
══════════════════════════════════════════════════ */
.note-detail-prominent {
  margin: -24px -24px 22px;
  padding: 0;
  background: linear-gradient(145deg, #1a0d00 0%, #2b1600 55%, #0c0a04 100%);
  border-bottom: 1px solid rgba(200, 140, 30, 0.2);
  position: relative;
  overflow: hidden;
}

/* Subtle oriental pattern overlay */
.note-detail-prominent::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(200, 140, 30, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(160, 80, 20, 0.07) 0%, transparent 50%);
  pointer-events: none;
}

.note-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 14px;
  position: relative;
}

.note-detail-icon {
  font-size: 20px;
  line-height: 1;
}

.note-detail-label {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(200, 140, 30, 0.7);
  font-weight: 600;
}

.note-detail-date {
  margin-left: auto;
  font-size: 11px;
  color: rgba(240, 217, 168, 0.35);
}

.note-detail-border {
  margin: 0 20px 20px;
  border: 1px solid rgba(200, 140, 30, 0.22);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(200, 140, 30, 0.07);
  padding: 20px 22px;
  position: relative;
}

/* Corner ornaments */
.note-detail-border::before,
.note-detail-border::after {
  content: '✦';
  position: absolute;
  font-size: 10px;
  color: rgba(200, 140, 30, 0.4);
}

.note-detail-border::before {
  top: 8px;
  left: 10px;
}

.note-detail-border::after {
  bottom: 8px;
  right: 10px;
}

.note-detail-content {
  font-size: 15px;
  line-height: 1.85;
  color: #e8d4a4;
  word-break: break-word;
}

.note-detail-content p {
  margin: 0 0 0.7em;
}

.note-detail-content ul,
.note-detail-content ol {
  padding-left: 1.4em;
  margin: 0 0 0.7em;
}

.note-detail-content b,
.note-detail-content strong {
  color: #f5e6c8;
}

.note-detail-content h1,
.note-detail-content h2,
.note-detail-content h3 {
  color: #f0d9a8;
  margin: 0.8em 0 0.4em;
}

.note-detail-content hr {
  border: none;
  border-top: 1px solid rgba(200, 140, 30, 0.2);
  margin: 1em 0;
}