/* Google Keep × Capacities Styling */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-surface: #f8fafc;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* 3-Tier Keep Color Palettes (High Specificity to override white backgrounds) */
.card-item.card-color-sand, .modal-dialog.card-color-sand, .capture-card.card-color-sand, .mini-card.card-color-sand, .card-color-sand, .color-sand { background-color: #fef9c3 !important; border-color: #fde047; }
.card-item.card-color-coral, .modal-dialog.card-color-coral, .capture-card.card-color-coral, .mini-card.card-color-coral, .card-color-coral, .color-coral { background-color: #fee2e2 !important; border-color: #fca5a5; }
.card-item.card-color-peach, .modal-dialog.card-color-peach, .capture-card.card-color-peach, .mini-card.card-color-peach, .card-color-peach, .color-peach { background-color: #ffedd5 !important; border-color: #fdba74; }
.card-item.card-color-mint, .modal-dialog.card-color-mint, .capture-card.card-color-mint, .mini-card.card-color-mint, .card-color-mint, .color-mint { background-color: #dcfce7 !important; border-color: #86efac; }
.card-item.card-color-sage, .modal-dialog.card-color-sage, .capture-card.card-color-sage, .mini-card.card-color-sage, .card-color-sage, .color-sage { background-color: #ccfbf1 !important; border-color: #5eead4; }
.card-item.card-color-fog, .modal-dialog.card-color-fog, .capture-card.card-color-fog, .mini-card.card-color-fog, .card-color-fog, .color-fog { background-color: #e0f2fe !important; border-color: #7dd3fc; }
.card-item.card-color-storm, .modal-dialog.card-color-storm, .capture-card.card-color-storm, .mini-card.card-color-storm, .card-color-storm, .color-storm { background-color: #dbeafe !important; border-color: #93c5fd; }
.card-item.card-color-dusk, .modal-dialog.card-color-dusk, .capture-card.card-color-dusk, .mini-card.card-color-dusk, .card-color-dusk, .color-dusk { background-color: #f3e8ff !important; border-color: #d8b4fe; }
.card-item.card-color-blossom, .modal-dialog.card-color-blossom, .capture-card.card-color-blossom, .mini-card.card-color-blossom, .card-color-blossom, .color-blossom { background-color: #fce7f3 !important; border-color: #f9a8d4; }
.card-item.card-color-clay, .modal-dialog.card-color-clay, .capture-card.card-color-clay, .mini-card.card-color-clay, .card-color-clay, .color-clay { background-color: #f5ebe0 !important; border-color: #e3d5ca; }
.card-item.card-color-chalk, .modal-dialog.card-color-chalk, .capture-card.card-color-chalk, .mini-card.card-color-chalk, .card-color-chalk, .color-chalk { background-color: #f8fafc !important; border-color: #e2e8f0; }
.card-item.card-color-blue, .modal-dialog.card-color-blue, .capture-card.card-color-blue, .mini-card.card-color-blue, .card-color-blue, .color-blue { background-color: #dbeafe !important; border-color: #93c5fd; }
.card-item.card-color-purple, .modal-dialog.card-color-purple, .capture-card.card-color-purple, .mini-card.card-color-purple, .card-color-purple, .color-purple { background-color: #f3e8ff !important; border-color: #d8b4fe; }
.card-item.card-color-green, .modal-dialog.card-color-green, .capture-card.card-color-green, .mini-card.card-color-green, .card-color-green, .color-green { background-color: #dcfce7 !important; border-color: #86efac; }
.card-item.card-color-orange, .modal-dialog.card-color-orange, .capture-card.card-color-orange, .mini-card.card-color-orange, .card-color-orange, .color-orange { background-color: #ffedd5 !important; border-color: #fdba74; }
.fullpage-card-card.card-color-date { background-color: var(--temporal-bg, #ffffff) !important; border-color: var(--temporal-border, #e2e8f0) !important; }

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-surface);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 24px 8px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.search-wrapper {
  flex: 1;
  max-width: 580px;
  position: relative;
  display: flex;
  align-items: center;
}

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

.search-wrapper input {
  width: 100%;
  padding: 10px 36px 10px 42px;
  background-color: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 24px;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-wrapper input:focus {
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.search-spinner {
  position: absolute;
  right: 36px;
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: search-spin 0.8s linear infinite;
}

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

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

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.nav-tab-btn.active {
  background-color: #e0e7ff;
  color: var(--primary);
  border-color: #c7d2fe;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* Filter Pills Bar */
.filter-bar {
  max-width: 1400px;
  margin: 8px auto 0 auto;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pills {
  display: flex;
  gap: 8px;
}

.filter-pill {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background-color: #f8fafc;
  color: var(--text-main);
}

.filter-pill.active {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 60px 20px;
}

/* =========================================================================
   Phase 5: Daily View Banner & Recurring Task Checklist
   ========================================================================= */

.daily-banner {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 32px;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.08);
}

.daily-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--temporal-border, #e2e8f0);
  transition: border-color 0.3s ease;
}

.daily-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.daily-date-icon {
  font-size: 2rem;
}

.daily-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  letter-spacing: -0.01em;
}

.daily-subtitle {
  font-size: 0.82rem;
  color: var(--temporal-accent, var(--text-muted, #64748b));
  font-weight: 500;
  transition: color 0.3s ease;
}

.daily-nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #ffffff;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: var(--shadow-sm);
}

.date-nav-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-nav-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: var(--border-subtle);
}

.date-nav-btn.today-jump {
  background-color: #f1f5f9;
  color: var(--text-main);
  border-color: var(--border-color, #e2e8f0);
  font-size: 0.75rem;
}

.date-nav-btn.today-jump:hover {
  background-color: #e2e8f0;
}

.daily-date-picker {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.daily-stats {
  display: flex;
  gap: 8px;
}

.badge {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-color, #e2e8f0);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Daily Note Journal Editor (Capacities Style) */
.daily-journal-section {
  background-color: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

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

.daily-journal-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-journal-icon {
  font-size: 1.05rem;
}

.daily-journal-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #15803d;
}

.save-status-mini {
  font-size: 0.72rem;
  color: #16a34a;
  font-weight: 500;
}

.daily-journal-editor {
  min-height: 90px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text-main);
  outline: none;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
  word-break: break-word;
  white-space: pre-wrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.daily-journal-editor:focus {
  background-color: #ffffff;
  border-color: #86efac;
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.25);
}

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

.daily-checklist-container {
  background-color: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 16px;
}

.daily-section-group {
  margin-bottom: 8px;
}

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

.daily-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #15803d;
}

.badge-mini {
  font-size: 0.68rem;
  font-weight: 600;
  background-color: #f1f5f9;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.daily-checklist-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: background 0.15s ease;
}

.daily-checklist-item:hover {
  background-color: #f1f5f9;
}

.task-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.task-item-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.task-completed .task-item-title {
  text-decoration: line-through;
  color: var(--text-faint);
}

/* Quick Capture Bar */
.capture-section {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.capture-card {
  width: 100%;
  max-width: 600px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.capture-card:focus-within, .capture-card:hover {
  box-shadow: 0 4px 14px rgba(60, 64, 67, 0.15);
  border-color: #cbd5e1;
}

.capture-collapsed {
  display: flex;
  align-items: center;
  padding: 8px 16px;
}

.capture-collapsed input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  padding: 8px 0;
  color: var(--text-main);
}

.capture-collapsed input::placeholder {
  color: var(--text-muted);
}

.capture-expanded {
  padding: 14px 16px 10px 16px;
}

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

.capture-title-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
}

.capture-title-input::placeholder {
  color: var(--text-muted);
}

.capture-pin-btn.active {
  color: var(--primary);
}

.capture-body-input {
  width: 100%;
  border: none;
  background: none;
  font-size: 0.92rem;
  color: var(--text-main);
  outline: none;
  resize: vertical;
  min-height: 70px;
  font-family: inherit;
  line-height: 1.5;
}

.capture-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.capture-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.btn {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-ghost {
  background: none;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* Card Wall Canvas */
.cards-section {
  margin-bottom: 36px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.section-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background-color: #e2e8f0;
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 10px;
}

/* Masonry Grid (Google Keep Multi-Column) */
.masonry-grid {
  column-count: 1;
  column-gap: 16px;
}

@media (min-width: 640px) { .masonry-grid { column-count: 2; } }
@media (min-width: 1024px) { .masonry-grid { column-count: 3; } }
@media (min-width: 1280px) { .masonry-grid { column-count: 4; } }

/* Card Item */
.card-item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 14px 16px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.card-item:hover {
  box-shadow: 0 4px 12px rgba(60, 64, 67, 0.15);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Type Badge with Icon */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.type-badge:hover {
  background-color: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-pin-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.card-pin-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--text-main);
}

.card-pin-btn.pinned {
  color: var(--primary);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.35;
  word-break: break-word;
}

.card-preview {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.45;
  margin-bottom: 12px;
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 280px;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.card-time {
  font-size: 0.72rem;
  color: var(--text-faint);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.card-item:hover .card-actions, .card-item:focus-within .card-actions {
  opacity: 1;
}

.action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

/* =========================================================================
   Modal Dialog & TipTap AST Canvas
   ========================================================================= */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-dialog {
  background-color: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  box-shadow: var(--shadow-modal);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.modal-dialog.small-dialog {
  max-width: 460px;
  background-color: #ffffff !important;
  border-radius: 14px;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px 20px;
}

.modal-type-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 500;
}

.modal-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-title-input {
  padding: 8px 20px;
  border: none;
  background: none;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  width: 100%;
}

.modal-title-input::placeholder {
  color: var(--text-muted);
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 20px 10px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn:hover {
  background-color: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
}

/* Rich Document Body (TipTap AST Canvas) */
.modal-editor {
  flex: 1;
  padding: 14px 20px;
  overflow-y: auto;
  min-height: 180px;
  max-height: 45vh;
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--text-main);
  outline: none;
  word-break: break-word;
}

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

/* Object Mention Chips */
.mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background-color: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  vertical-align: baseline;
  transition: all 0.15s ease;
  margin: 0 2px;
}

.mention-chip:hover {
  background-color: #c7d2fe;
  color: #1e1b4b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mention-chip-label {
  display: inline;
}

.mention-chip-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #6366f1;
  font-size: 0.74rem;
  font-weight: 700;
  margin-left: 2px;
  padding: 0 3px;
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  transition: all 0.15s ease;
}

.mention-chip-del:hover {
  background-color: rgba(79, 70, 229, 0.25);
  color: #1e1b4b;
}

/* Mention Popover Dropdown */
.mention-popover {
  position: absolute;
  z-index: 120;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 260px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.12s ease;
}

.mention-search-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: #f8fafc;
}

.mention-search-header input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.84rem;
  outline: none;
}

.mention-results-list {
  overflow-y: auto;
  max-height: 220px;
  padding: 4px;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.mention-item:hover {
  background-color: #f1f5f9;
}

.mention-item.active {
  background-color: #e0e7ff;
  color: var(--primary);
}

.mention-item-title {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dynamic Embedded Query View Block */
.query-blocks-container {
  padding: 0 20px 10px 20px;
}

.embedded-query-block {
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.query-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.query-block-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.query-block-tag {
  background-color: #e0e7ff;
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

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

.query-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.query-delete-btn:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

.card-query-indicator {
  margin: 6px 0;
}

.card-query-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4f46e5;
  background-color: rgba(99, 102, 241, 0.1);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.query-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.mini-card {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mini-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.mini-card-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-card-preview {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Graph Neighborhood / Backlinks Panel */
.graph-panel {
  padding: 10px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background-color: rgba(248, 250, 252, 0.6);
}

.graph-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.backlinks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backlink-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backlink-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.backlink-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background-color: rgba(0, 0, 0, 0.06);
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

.backlink-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.backlink-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.backlink-pill:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-prune-instances {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: fit-content;
}

.btn-prune-instances:hover:not(:disabled) {
  background-color: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.btn-prune-instances:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background-color: rgba(255, 255, 255, 0.4);
}

.modal-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Query & Embed Config Forms */
.query-config-form {
  padding: 12px 20px 16px 20px;
}

.query-input-select, .query-input-text {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.query-input-select:focus, .query-input-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Palette Popovers */
.palette-popover {
  position: absolute;
  z-index: 150;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 170px;
}

.palette-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.palette-circle:hover {
  transform: scale(1.15);
  border-color: rgba(0, 0, 0, 0.4);
}

.palette-reset-btn {
  grid-column: span 4;
  margin-top: 4px;
  padding: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
}

.palette-reset-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* Dropdown Menus */
.dropdown-menu {
  position: absolute;
  z-index: 150;
  background-color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 160px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background-color: #f1f5f9;
}

.dropdown-item.active {
  background-color: #e0e7ff;
  color: var(--primary);
  font-weight: 600;
}

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

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

.empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-subtitle {
  font-size: 0.9rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e293b;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Capacities-Style Property Inspector (Phase 6) */
.property-inspector {
  margin: 4px 20px 12px 20px;
  padding: 10px 14px;
  background-color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.property-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.property-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
}

.property-key-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: capitalize;
}

.property-value-wrapper {
  display: flex;
  align-items: center;
}

.property-input, .property-select {
  width: 100%;
  max-width: 280px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background-color: #ffffff;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
}

.property-input:focus, .property-select:focus {
  border-color: var(--primary);
}

/* Settings Dialog (Object Types & Schemas) */
.settings-dialog {
  max-width: 800px;
  max-height: 85vh;
}

.settings-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-top: 1px solid var(--border-subtle);
  min-height: 380px;
  max-height: 60vh;
  overflow-y: auto;
}

.settings-types-sidebar {
  border-right: 1px solid var(--border-subtle);
  background-color: #f8fafc;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-type-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease;
}

.settings-type-btn:hover {
  background-color: #e2e8f0;
}

.settings-type-btn.active {
  background-color: #e0e7ff;
  color: var(--primary);
  font-weight: 600;
}

.settings-type-content {
  padding: 16px 20px;
  overflow-y: auto;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.settings-input, .settings-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  background-color: #ffffff;
}

.settings-section-subtitle {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.settings-prop-table {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background-color: #ffffff;
}

.settings-prop-row {
  display: grid;
  grid-template-columns: 140px 100px 1fr 40px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
  gap: 8px;
}

.settings-prop-row:last-child {
  border-bottom: none;
}

.add-prop-box {
  background-color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
}

.add-prop-form {
  display: grid;
  grid-template-columns: 1fr 110px 1.2fr auto;
  gap: 8px;
  align-items: center;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* Phase 7: Recurrence & Automation Badges and Builders */
.card-badges-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.badge-recurrence {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.70rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background-color: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  user-select: none;
}

.badge-instance {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.70rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  user-select: none;
}

.instance-parent-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #4338ca;
  background-color: #e0e7ff;
  border: 1px solid #c7d2fe;
  border-radius: 9999px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.instance-parent-badge:hover {
  background-color: #c7d2fe;
  border-color: #a5b4fc;
}

.recurrence-builder-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.recurrence-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recurrence-days-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.day-pill {
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background-color: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.day-pill:hover {
  border-color: #94a3b8;
  background-color: #f1f5f9;
}

.day-pill.active {
  background-color: #6366f1;
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.3);
}

.recurrence-explanation {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.btn-automation-run {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.25);
  transition: all 0.15s ease;
}

.btn-automation-run:hover:not(:disabled) {
  background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  box-shadow: 0 3px 6px rgba(234, 88, 12, 0.35);
  transform: translateY(-1px);
}

.btn-automation-run:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.instance-info-box {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: #1e40af;
}

.instance-info-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.instance-info-btn {
  background-color: #ffffff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.instance-info-btn:hover {
  background-color: #dbeafe;
}

.hidden {
  display: none !important;
}

/* Phase 8: Rich In-Note Blocks, Images & Media */

/* 1. Keep Card Wall Image Covers */
.card-image-cover {
  width: calc(100% + 24px);
  margin: -12px -12px 10px -12px;
  max-height: 180px;
  overflow: hidden;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  background-color: rgba(0, 0, 0, 0.04);
}

.card-image-cover img {
  width: 100%;
  height: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.card-item:hover .card-image-cover img {
  transform: scale(1.02);
}

/* 2. Card Wall Tag Chips & Sub-Footers */
.card-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 4px 0;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.card-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  border: 1px solid rgba(13, 148, 136, 0.25);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-tag-chip:hover {
  background: rgba(13, 148, 136, 0.22);
  border-color: #0f766e;
}

.card-tag-chip .tag-del-btn {
  font-size: 0.68rem;
  opacity: 0.6;
  margin-left: 2px;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.card-tag-chip .tag-del-btn:hover {
  opacity: 1;
  background-color: rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

.card-tag-chip.tag-add-btn {
  background: rgba(241, 245, 249, 0.9);
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
}

.card-tag-chip.tag-add-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: var(--text-muted);
}

.inline-preview-tag {
  display: inline-block;
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 0.82em;
  font-weight: 500;
  vertical-align: baseline;
}

/* Modal & Full-Page Tags Sub-Footer Section */
.modal-tags-section {
  margin: 12px 0 8px 0;
  padding: 8px 12px;
  background: rgba(241, 245, 249, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.modal-tags-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.modal-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 3. Editor Image Blocks */
.editor-image-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #f8fafc;
  vertical-align: middle;
}

.editor-image-wrapper img {
  max-width: 100%;
  max-height: 420px;
  display: block;
  border-radius: 6px;
  object-fit: contain;
}

.editor-image-wrapper .image-del-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.65);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  opacity: 0.85;
  transition: all 0.15s ease;
  z-index: 2;
}

.editor-image-wrapper .image-del-btn:hover {
  background: rgba(220, 38, 38, 0.9);
  opacity: 1;
  transform: scale(1.1);
}

.modal-editor.drag-over {
  outline: 2px dashed #6366f1;
  background-color: rgba(99, 102, 241, 0.04);
}

/* Quick capture image preview */
.capture-image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 14px;
}

.capture-image-preview-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.capture-image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capture-image-preview-item .preview-del-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 4. Link Embed Blocks (Google Drive & Web URLs) */
.editor-link-embed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 10px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background-color: #f8fafc;
  user-select: none;
  transition: all 0.15s ease;
}

.editor-link-embed:hover {
  border-color: #cbd5e1;
  background-color: #f1f5f9;
}

.link-embed-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.link-embed-details {
  flex: 1;
  min-width: 0;
}

.link-embed-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-embed-title:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.link-embed-domain {
  font-size: 0.73rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.embed-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.7;
  transition: all 0.15s ease;
}

.embed-del-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  opacity: 1;
}

/* 5. Inline #tags Chips */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  margin: 0 2px;
  background-color: #ccfbf1;
  color: #0f766e;
  border: 1px solid #99f6e4;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  vertical-align: baseline;
  user-select: none;
  transition: all 0.15s ease;
}

.tag-chip:hover {
  background-color: #99f6e4;
  border-color: #5eead4;
}

.tag-chip .tag-hash {
  opacity: 0.7;
  font-weight: 700;
}

.tag-chip .tag-label {
  font-family: inherit;
}

.tag-chip-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #0f766e;
  font-size: 9px;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  opacity: 0.7;
}

.tag-chip-del:hover {
  background-color: rgba(15, 118, 110, 0.2);
  opacity: 1;
}

/* --- Phase 10: Full-Page View Styles --- */
.fullpage-canvas {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 48px;
  animation: fadeIn 0.15s ease-out;
}

.fullpage-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fullpage-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fullpage-nav-left,
.fullpage-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fullpage-back-btn {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fullpage-modal-btn {
  color: var(--text-muted, #64748b);
  font-size: 0.85rem;
}

.fullpage-modal-btn:hover {
  color: var(--text-color, #0f172a);
}

.fullpage-card-card {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 28px 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Two-Column Studio Layout */
.fullpage-studio-columns {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  width: 100%;
}

.fullpage-main-col {
  flex: 1 1 65%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fullpage-side-col {
  flex: 0 0 340px;
  max-width: 400px;
  min-width: 290px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(248, 250, 252, 0.7);
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
}

@media (max-width: 900px) {
  .fullpage-studio-columns {
    flex-direction: column;
  }
  .fullpage-side-col {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

.fullpage-title-input {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  padding: 4px 0 12px;
  font-family: inherit;
}

.fullpage-title-input::placeholder {
  color: var(--text-muted, #94a3b8);
  opacity: 0.7;
}

.fullpage-editor {
  min-height: 320px;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-color, #1e293b);
  outline: none;
  padding: 10px 0;
  font-family: inherit;
}

.fullpage-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted, #94a3b8);
  pointer-events: none;
  display: block;
}

.inspect-modal-btn {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  color: var(--text-color, #334155);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inspect-modal-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

/* Date Studio & Created Cards Gallery */
.fullpage-date-studio {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.fullpage-daily-created-section {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 24px;
  margin-top: 24px;
}

.empty-gallery-msg {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  grid-column: 1 / -1;
}

/* Phase 9: Search Highlight & Infinite Scroll Styles */
mark.search-match {
  background-color: #fef08a;
  color: #0f172a;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 3px;
}

.infinite-scroll-sentinel {
  width: 100%;
  padding: 32px 0 48px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.infinite-scroll-spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.infinite-scroll-spinner .spinner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  animation: dot-bounce 1.4s infinite ease-in-out both;
}

.infinite-scroll-spinner .spinner-dot:nth-child(1) { animation-delay: -0.32s; }
.infinite-scroll-spinner .spinner-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* =========================================================================
   Phase 11: Card Lock Protection & Temporal Date Themes
   ========================================================================= */

/* Lock Button States */
.lock-btn {
  color: var(--text-muted, #64748b);
  transition: all 0.2s ease;
}

.lock-btn:hover {
  color: #d97706;
  background-color: rgba(217, 119, 6, 0.08);
}

.lock-btn.locked {
  color: #b45309;
  background-color: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
}

.lock-btn.locked .icon-unlocked {
  display: none !important;
}

.lock-btn.locked .icon-locked {
  display: block !important;
}

.lock-btn:not(.locked) .icon-locked {
  display: none !important;
}

.lock-btn:not(.locked) .icon-unlocked {
  display: block !important;
}

/* Card Lock Banners */
.card-lock-banner {
  background-color: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 16px 14px 16px;
  animation: slideDown 0.2s ease;
}

.card-lock-banner.hidden {
  display: none !important;
}

/* Card Wall Lock Indicator */
.card-lock-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  color: #b45309;
  opacity: 0.8;
  margin-left: 6px;
  vertical-align: middle;
}

/* Locked Card Interactive Restraints */
.is-card-locked .editor-toolbar,
.is-card-locked .modal-toolbar {
  opacity: 0.45;
  pointer-events: none;
}

.is-card-locked .modal-color-palette,
.is-card-locked .modal-delete-btn,
.is-card-locked #modalDeleteBtn {
  opacity: 0.4;
  pointer-events: none;
}

.is-card-locked input[type="text"].modal-title-input,
.is-card-locked input[type="text"].fullpage-title-input {
  cursor: default;
}

.is-card-locked .modal-editor-content[contenteditable="false"],
.is-card-locked .fullpage-editor-content[contenteditable="false"],
.is-card-locked .daily-journal-editor[contenteditable="false"] {
  cursor: default;
  user-select: text;
}

/* Temporal Date Studio Styles & Smooth Transitions */
.fullpage-card-card {
  transition: background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.today-jump.highlighted {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.35);
}

.today-jump.highlighted:hover {
  background-color: #2563eb !important;
}

.date-nav-btn {
  transition: all 0.2s ease;
}

/* =========================================================================
   Mobile & Touchscreen Responsive Enhancements
   ========================================================================= */

@media (max-width: 768px) {
  /* Global Touch & Viewport Safeguards */
  body {
    -webkit-tap-highlight-color: transparent;
  }

  /* Prevent iOS Safari auto-zoom on input focus */
  input[type="text"],
  input[type="password"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Top Navigation Bar: Clean 2-Row Mobile Header */
  .navbar {
    padding: 8px 12px 10px 12px;
  }

  .nav-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
  }

  .brand {
    order: 1;
    gap: 8px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    display: none;
  }

  .nav-actions {
    order: 2;
    margin-left: auto;
    gap: 4px;
  }

  .nav-tab-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    gap: 4px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  /* Full-Width Search Bar on Row 2 */
  .search-wrapper {
    order: 3;
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
    margin-top: 4px;
  }

  .search-wrapper input {
    padding: 9px 36px 9px 38px;
    border-radius: 20px;
  }

  /* Filter Pills Bar: Smooth horizontal touch scroll */
  .filter-bar {
    padding: 4px 0 6px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-pill {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  /* Main Workspace: Maximize card width on small screens */
  .main-container {
    padding: 12px 10px 48px 10px;
  }

  /* Quick Capture Section */
  .capture-section {
    margin-bottom: 20px;
    padding: 0;
  }

  .capture-card {
    max-width: 100%;
    border-radius: 10px;
  }

  .capture-collapsed {
    padding: 10px 14px;
  }

  .capture-collapsed input {
    font-size: 16px !important;
  }

  .capture-expanded {
    padding: 12px 14px 10px 14px;
  }

  .capture-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .capture-actions .action-btn {
    min-height: 36px;
    min-width: 36px;
  }

  /* Card Grid & Cards */
  .masonry-grid {
    column-count: 1 !important;
    gap: 12px;
  }

  .card-item {
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 10px;
  }

  .card-title {
    font-size: 1.02rem;
  }

  .card-preview {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* Always visible action buttons on touchscreens (no hover required) */
  .card-actions {
    opacity: 0.9 !important;
    visibility: visible !important;
  }

  .card-actions .action-btn {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  /* Full-Page Canvas & Studios */
  .fullpage-canvas {
    padding: 8px 8px 36px 8px;
  }

  .fullpage-container {
    gap: 10px;
  }

  .fullpage-nav-bar {
    padding: 8px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .fullpage-nav-left {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .fullpage-nav-right {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 6px;
  }

  .fullpage-card-card {
    padding: 16px 12px;
    border-radius: 10px;
    gap: 12px;
  }

  .fullpage-title-input {
    font-size: 1.35rem;
    font-size: 16px !important;
    padding: 4px 0 8px;
  }

  .fullpage-editor {
    min-height: 220px;
    font-size: 16px !important;
  }

  /* Date Studio Header: Stack title and nav controls for easy thumb reach */
  .daily-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .daily-title-wrapper {
    gap: 8px;
  }

  .daily-date-icon {
    font-size: 1.5rem;
  }

  .daily-title {
    font-size: 1.15rem;
  }

  .daily-subtitle {
    font-size: 0.8rem;
  }

  .daily-nav-controls {
    width: 100%;
    justify-content: space-between;
    padding: 6px 8px;
    gap: 4px;
  }

  .date-nav-btn {
    padding: 6px 10px;
    font-size: 0.82rem;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .date-nav-input {
    max-width: 120px;
    font-size: 14px;
  }

  /* Touch-Friendly Checklists */
  .daily-checklist-container {
    padding: 12px 10px;
    border-radius: 10px;
  }

  .daily-section-title {
    font-size: 0.85rem;
  }

  .daily-checklist-item {
    padding: 10px 10px;
  }

  .task-checkbox-label {
    gap: 10px;
  }

  .task-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    cursor: pointer;
  }

  .task-checkbox-text {
    font-size: 0.92rem;
    line-height: 1.4;
  }
}

/* Compact Mobile Screens (< 640px) */
@media (max-width: 640px) {
  /* Modals: Bottom-Sheet Style with Maximum Touch Usability */
  .modal-backdrop {
    padding: 6px 4px 0 4px;
    align-items: flex-end;
  }

  .modal-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
  }

  .modal-top {
    padding: 12px 14px 4px 14px;
  }

  .modal-title-input {
    font-size: 1.25rem;
    font-size: 16px !important;
    padding: 4px 14px;
  }

  .modal-editor-content {
    min-height: 200px;
    padding: 8px 14px;
    font-size: 16px !important;
  }

  .modal-footer {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
  }

  .modal-toolbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .modal-toolbar .toolbar-btn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .modal-done-btn {
    min-height: 36px;
    padding: 6px 18px;
    font-size: 0.9rem;
  }

  /* Settings Modal on Mobile: Stack Sidebar Above Editor */
  .settings-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
  }

  .settings-body {
    grid-template-columns: 1fr;
    max-height: 70vh;
  }

  .settings-types-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .settings-type-btn {
    white-space: nowrap;
    flex: 0 0 auto;
    width: auto;
    padding: 6px 12px;
  }

  .settings-editor {
    padding: 14px 12px;
  }

  /* Centered Touch Popovers (Palettes, Menus) */
  .color-palette-popover,
  .type-convert-popover {
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    max-width: 95vw;
  }

  /* Compact Button Text for Small Screens */
  .nav-tab-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
  }
}



