/* ==========================================================================
   Nexus Design System Stylesheet — Authentic Notion Palette & Architecture
   Polymorphic Multi-View Engine: Board, Dynamic Table, Media Hub, Timeline, Calendar, To-Do
   View Tab Management, Priority Engine & Customizable Data Table Engine
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties for Theming
   -------------------------------------------------------------------------- */
:root {
  /* Crisp Canvas & Cards */
  --bg-canvas: #F8F9FA;
  --bg-sidebar: #F1F3F5;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F1F5F9;
  --bg-popover: #FFFFFF;
  --bg-input: #FFFFFF;

  /* Sharpened High-Contrast Borders */
  --border-subtle: #D8DEE4;  /* Crisp definition for card edges */
  --border-hover: #94A3B8;

  /* Deep High-Legibility Typography */
  --text-primary: #0F172A;   /* Pure crisp slate-black */
  --text-secondary: #334155; /* Deep readable charcoal (Never washed-out) */
  --text-muted: #64748B;     /* Sharp secondary contrast */

  --scrollbar-thumb: #CBD5E1;
  --scrollbar-thumb-hover: #94A3B8;
  --row-hover: rgba(15, 23, 42, 0.04);
  --row-active: rgba(15, 23, 42, 0.08);
  --header-bg: rgba(248, 249, 250, 0.92);
  --table-header-bg: #F1F5F9;
  --timeline-track-bg: rgba(15, 23, 42, 0.03);
  --timeline-grid-line: #D8DEE4;

  color-scheme: light;
}

html.dark {
  --bg-canvas: #090A0F;
  --bg-sidebar: #0D0E12;
  --bg-surface: #12141C;
  --bg-surface-subtle: #181B24;
  --bg-popover: #181A20;
  --bg-input: #12141C;
  --border-subtle: #222634;
  --border-hover: #32384A;
  --text-primary: #F4F4F5;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --scrollbar-thumb: #27272A;
  --scrollbar-thumb-hover: #3F3F46;
  --row-hover: rgba(255, 255, 255, 0.04);
  --row-active: rgba(255, 255, 255, 0.07);
  --header-bg: rgba(9, 10, 15, 0.88);
  --table-header-bg: #141720;
  --timeline-track-bg: rgba(255, 255, 255, 0.02);
  --timeline-grid-line: #222634;

  color-scheme: dark;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* --------------------------------------------------------------------------
   2. Scrollbars
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* --------------------------------------------------------------------------
   3. Micro Animations
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-fade-in {
  animation: fadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --------------------------------------------------------------------------
   4. Sidebar Elements & Theme-Aware States
   -------------------------------------------------------------------------- */
.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #1E293B;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
}

html.dark .sidebar-nav-btn {
  color: #E4E4E7;
}

.sidebar-nav-btn:hover {
  color: #0F172A;
  background-color: var(--row-hover);
}

html.dark .sidebar-nav-btn:hover {
  color: #FFFFFF;
}

.sidebar-nav-btn.active {
  color: #0F172A !important;
  background-color: #E2E8F0 !important;
  border-color: var(--border-subtle) !important;
  font-weight: 600 !important;
}

html.dark .sidebar-nav-btn.active {
  color: #FFFFFF !important;
  background-color: #1E293B !important;
  border-color: #334155 !important;
}

.sidebar-item-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
  user-select: none;
  cursor: pointer;
}

.sidebar-item-row:hover {
  background-color: var(--row-hover);
}

.sidebar-item-row.active {
  background-color: #E2E8F0 !important;
  border: 1px solid var(--border-subtle);
}

html.dark .sidebar-item-row.active {
  background-color: #1E293B !important;
  border-color: #334155 !important;
}

.category-header-row .category-title-text {
  font-size: 13px;
  font-weight: 600;
  color: #0F172A;
  letter-spacing: -0.01em;
}

html.dark .category-header-row .category-title-text {
  color: #F4F4F5;
}

.subitem-row .subitem-title-text {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #1E293B !important;
  transition: color 0.12s ease;
}

html.dark .subitem-row .subitem-title-text {
  color: #E4E4E7 !important;
}

.subitem-row:hover .subitem-title-text {
  color: #0F172A !important;
}

html.dark .subitem-row:hover .subitem-title-text {
  color: #FFFFFF !important;
}

.subitem-row.active .subitem-title-text {
  color: #0F172A !important;
  font-weight: 600;
}

html.dark .subitem-row.active .subitem-title-text {
  color: #FFFFFF !important;
  font-weight: 600;
}

.sidebar-icon {
  width: 16px;
  height: 16px;
  color: #475569 !important;
  flex-shrink: 0;
  stroke-width: 1.75px;
  transition: color 0.12s ease;
}

html.dark .sidebar-icon {
  color: #A1A1AA !important;
}

.sidebar-item-row:hover .sidebar-icon,
.sidebar-nav-btn:hover .sidebar-icon {
  color: #0F172A !important;
}

html.dark .sidebar-item-row:hover .sidebar-icon,
html.dark .sidebar-nav-btn:hover .sidebar-icon {
  color: #FFFFFF !important;
}

.sidebar-item-row.active .sidebar-icon,
.sidebar-nav-btn.active .sidebar-icon {
  color: #0F172A !important;
}

html.dark .sidebar-item-row.active .sidebar-icon,
html.dark .sidebar-nav-btn.active .sidebar-icon {
  color: #FFFFFF !important;
}

.accordion-toggle-btn {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.12s ease;
}

.accordion-toggle-btn:hover {
  color: var(--text-primary);
  background-color: var(--row-hover);
}

.sub-items-container {
  border-left: 1px solid var(--border-subtle);
  margin-left: 14px;
  padding-left: 8px;
  margin-top: 2px;
}

.drag-gutter {
  position: absolute;
  left: 4px;
  width: 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 10;
}

.drag-gutter:active {
  cursor: grabbing;
}

.drag-gutter i,
.drag-gutter svg,
.drag-gutter [data-lucide="grip-vertical"] {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
  color: var(--text-muted);
  stroke-width: 1.5px;
  transition: opacity 0.15s ease, visibility 0.15s ease, color 0.15s ease;
}

.drag-gutter:hover i,
.drag-gutter:hover svg,
.drag-gutter:hover [data-lucide="grip-vertical"] {
  opacity: 1 !important;
  visibility: visible;
  pointer-events: auto;
  color: var(--text-primary);
}

.row-label-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  transform: translateX(0);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.drag-gutter:hover ~ .row-label-group {
  transform: translateX(14px);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-item-row:hover .row-actions {
  opacity: 1;
  pointer-events: auto;
}

.action-btn {
  padding: 3px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.12s ease;
}

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

.action-btn.delete-btn:hover {
  color: #EF4444;
  background-color: rgba(239, 68, 68, 0.12);
}

.accordion-chevron {
  width: 14px;
  height: 14px;
  stroke-width: 1.5px;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-chevron.expanded {
  transform: rotate(90deg);
}

.accordion-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
  opacity: 1;
}

.accordion-content.collapsed {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.sortable-ghost {
  opacity: 0.35 !important;
  background-color: var(--row-hover) !important;
  border-radius: 6px;
}

.sortable-drag {
  cursor: grabbing !important;
  opacity: 0.95;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.3);
}

/* --------------------------------------------------------------------------
   5. Authentic Notion Pastel Palette (Zero Outer Borders + High Contrast)
   -------------------------------------------------------------------------- */

/* Gray */
.notion-tag-gray, .chip-gray {
  background-color: #F4F4F5;
  color: #3F3F46;
  border: none !important;
}
html.dark .notion-tag-gray, html.dark .chip-gray {
  background-color: rgba(63, 63, 70, 0.7);
  color: #D4D4D8;
  border: none !important;
}

/* Brown */
.notion-tag-brown, .chip-brown {
  background-color: #F4EEEE;
  color: #976D57;
  border: none !important;
}
html.dark .notion-tag-brown, html.dark .chip-brown {
  background-color: rgba(56, 40, 30, 0.75);
  color: #D7A98C;
  border: none !important;
}

/* Orange */
.notion-tag-orange, .chip-orange {
  background-color: #FAECE4;
  color: #D9730D;
  border: none !important;
}
html.dark .notion-tag-orange, html.dark .chip-orange {
  background-color: rgba(63, 43, 29, 0.75);
  color: #F0A06D;
  border: none !important;
}

/* Yellow / Medium Priority */
.notion-tag-yellow, .chip-yellow, .notion-priority-medium {
  background-color: #FEF9C3;
  color: #A16207;
  border: none !important;
}
html.dark .notion-tag-yellow, html.dark .chip-yellow, html.dark .notion-priority-medium {
  background-color: #3A331A;
  color: #FDE047;
  border: none !important;
}

/* Green */
.notion-tag-green, .chip-green {
  background-color: #EDF3EC;
  color: #0F7B6C;
  border: none !important;
}
html.dark .notion-tag-green, html.dark .chip-green {
  background-color: rgba(30, 51, 41, 0.75);
  color: #86CDA5;
  border: none !important;
}

/* Blue / Low Priority */
.notion-tag-blue, .chip-blue, .notion-priority-low {
  background-color: #E7F3F8;
  color: #0B6E99;
  border: none !important;
}
html.dark .notion-tag-blue, html.dark .chip-blue, html.dark .notion-priority-low {
  background-color: #1D2F3F;
  color: #7BB8E8;
  border: none !important;
}

/* Purple */
.notion-tag-purple, .chip-purple {
  background-color: #F4F0F7;
  color: #6940A5;
  border: none !important;
}
html.dark .notion-tag-purple, html.dark .chip-purple {
  background-color: rgba(46, 35, 62, 0.75);
  color: #C49DE8;
  border: none !important;
}

/* Pink */
.notion-tag-pink, .chip-pink {
  background-color: #FBF0F4;
  color: #AD1A72;
  border: none !important;
}
html.dark .notion-tag-pink, html.dark .chip-pink {
  background-color: rgba(59, 31, 45, 0.75);
  color: #E58BAC;
  border: none !important;
}

/* Red / High Priority */
.notion-tag-red, .chip-red, .notion-priority-urgent, .notion-priority-high {
  background-color: #FEE2E2;
  color: #B91C1C;
  border: none !important;
}
html.dark .notion-tag-red, html.dark .chip-red, html.dark .notion-priority-urgent, html.dark .notion-priority-high {
  background-color: #3E1F1F;
  color: #FCA5A5;
  border: none !important;
}

/* None Priority */
.notion-priority-none {
  background-color: #F4F4F5;
  color: #52525B;
  border: none !important;
}
html.dark .notion-priority-none {
  background-color: rgba(39, 39, 42, 0.6);
  color: #A1A1AA;
  border: none !important;
}

/* Swatches */
.notion-swatch-sq {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.notion-swatch-sq.gray   { background-color: #9CA3AF; }
.notion-swatch-sq.brown  { background-color: #976D57; }
.notion-swatch-sq.orange { background-color: #D9730D; }
.notion-swatch-sq.yellow { background-color: #DFAB01; }
.notion-swatch-sq.green  { background-color: #0F7B6C; }
.notion-swatch-sq.blue   { background-color: #0B6E99; }
.notion-swatch-sq.purple { background-color: #6940A5; }
.notion-swatch-sq.pink   { background-color: #AD1A72; }
.notion-swatch-sq.red    { background-color: #E03E3E; }

/* Calendar Event Pill */
.event-pill {
  display: block;
  width: 100%;
  font-size: 11px;
  line-height: 1.35;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s ease, transform 0.1s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-pill:hover {
  filter: brightness(1.08);
  transform: translateY(-0.5px);
}

.span-pill {
  border-radius: 3px;
  padding: 1.5px 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   6. Modular Project View Switcher & Tab Management (Close Buttons)
   -------------------------------------------------------------------------- */
.project-view-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 0 4px 0;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.project-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.12s ease;
  user-select: none;
  cursor: pointer;
  position: relative;
}

.project-tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--row-hover);
}

.project-tab-btn.active {
  color: var(--text-primary);
  background-color: var(--row-active);
  border-color: var(--border-subtle);
  font-weight: 600;
}

.tab-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  color: var(--text-muted);
  opacity: 0;
  pointer-events: none;
  transition: all 0.12s ease;
  margin-left: 2px;
}

.project-tab-btn:hover .tab-close-btn {
  opacity: 1;
  pointer-events: auto;
}

.tab-close-btn:hover {
  color: #EF4444;
  background-color: rgba(239, 68, 68, 0.15);
}

.add-view-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  transition: all 0.12s ease;
  cursor: pointer;
}

.add-view-dropdown-btn:hover {
  color: var(--text-primary);
  background-color: var(--row-hover);
}

/* --------------------------------------------------------------------------
   7. Nested Subject-Categorized Media Vault Styles
   -------------------------------------------------------------------------- */
.media-subject-group {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
  transition: border-color 0.15s ease;
}

.media-subject-group:hover {
  border-color: var(--border-hover);
}

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

.media-subject-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--text-muted);
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  transition: all 0.12s ease;
}

.media-subject-add-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background-color: var(--bg-surface-subtle);
}

.media-card-item {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.14s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.media-card-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.12);
}

.media-card-item.watched {
  opacity: 0.65;
}

.media-card-item.watched .media-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   8. Polymorphic Customizable Data Table Engine
   -------------------------------------------------------------------------- */
.table-view-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow-x: auto;
}

.spreadsheet-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.table-th-header {
  background-color: var(--table-header-bg);
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  user-select: none;
  position: relative;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.table-th-header:hover {
  background-color: var(--row-hover);
}

.table-th-header.col-dragging {
  opacity: 0.4;
  background-color: var(--row-hover);
}

.table-th-header.col-drag-over-left {
  box-shadow: inset 3px 0 0 0 #6366F1 !important;
}

.table-th-header.col-drag-over-right {
  box-shadow: inset -3px 0 0 0 #6366F1 !important;
}

.drive-attachment-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.12s ease;
}

.drive-attachment-badge:hover {
  filter: brightness(1.08);
  transform: translateY(-0.5px);
}

.table-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
}

.table-header-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.table-th-header:hover .table-header-label {
  color: var(--text-primary);
}

.table-th-menu-trigger {
  opacity: 0;
  padding: 2px;
  border-radius: 3px;
  color: var(--text-muted);
  transition: opacity 0.12s ease;
}

.table-th-header:hover .table-th-menu-trigger {
  opacity: 1;
}

.table-th-add-col {
  width: 44px;
  padding: 4px;
  background-color: var(--table-header-bg);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.add-col-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.12s ease;
}

.add-col-btn:hover {
  color: var(--text-primary);
  background-color: var(--row-hover);
}

.spreadsheet-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  transition: background-color 0.12s ease;
  position: relative;
}

.spreadsheet-table td:last-child {
  border-right: none;
}

.spreadsheet-table tr:hover td {
  background-color: var(--row-hover);
}

.row-open-trigger {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.spreadsheet-table tr:hover .row-open-trigger {
  opacity: 1;
}

.table-cell-input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--text-primary);
  padding: 2px 4px;
  border-radius: 4px;
  outline: none;
  transition: background-color 0.12s ease;
}

.table-cell-input:hover,
.table-cell-input:focus {
  background-color: var(--bg-surface-subtle);
}

.table-fast-new-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-canvas);
  border-top: 1px solid var(--border-subtle);
}

.table-fast-new-row input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
}

/* Priority Badges & Triggers */
.notion-priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s ease, transform 0.08s ease;
  border: none !important;
}

.notion-priority-badge:hover {
  filter: brightness(1.08);
}

.notion-priority-badge:active {
  transform: scale(0.96);
}

/* --------------------------------------------------------------------------
   9. Kanban, To-Do List & Timeline Views
   -------------------------------------------------------------------------- */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}

.kanban-column {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 380px;
}

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

.kanban-cards-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 120px;
}

.kanban-card {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  cursor: grab;
  user-select: none;
  transition: border-color 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease;
}

.kanban-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.15);
}

.kanban-card:active {
  cursor: grabbing;
}

/* Simple To-Do List View Styles */
.todo-view-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem;
}

.todo-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  transition: all 0.14s ease;
}

.todo-item-row:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface-subtle);
}

.todo-item-row.completed {
  opacity: 0.55;
  border-color: transparent;
  background-color: var(--row-hover);
}

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

/* Timeline / Gantt Roadmap View */
.timeline-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
}

.timeline-header-days {
  display: grid;
  grid-template-columns: 200px repeat(14, minmax(52px, 1fr));
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.timeline-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 200px repeat(14, minmax(52px, 1fr));
  align-items: center;
  min-height: 36px;
  border-radius: 6px;
  position: relative;
}

.timeline-row:hover {
  background-color: var(--timeline-track-bg);
}

.timeline-track-cell {
  border-right: 1px dashed var(--timeline-grid-line);
  height: 100%;
}

.timeline-bar {
  position: absolute;
  height: 24px;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.1s ease;
  z-index: 10;
}

.timeline-bar:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   10. Notion Page Modal & Dynamic Popovers
   -------------------------------------------------------------------------- */
.notion-property-row {
  display: grid;
  grid-template-columns: 140px 1fr 28px;
  align-items: center;
  min-height: 34px;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background-color 0.12s ease;
}

.notion-property-row:hover {
  background-color: var(--row-hover);
}

.notion-property-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px !important;
  font-size: 0.845rem !important;
  font-weight: 500 !important;
  color: #1F2937 !important;
  user-select: none;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

html.dark .notion-property-label {
  color: #E4E4E7 !important;
}

.notion-property-label:hover {
  background-color: var(--row-hover);
}

/* Icons inside Labels */
.notion-property-label i,
.notion-property-label svg,
.notion-property-label [data-lucide] {
  color: #4B5563 !important;
  stroke-width: 1.75px !important;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

html.dark .notion-property-label i,
html.dark .notion-property-label svg,
html.dark .notion-property-label [data-lucide] {
  color: #A1A1AA !important;
}

/* Toggles & Checkbox Labels ("End date", "Include time") */
#pageModalCard .notion-property-value label,
#pageModalCard .notion-property-value label span {
  color: #374151 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

html.dark #pageModalCard .notion-property-value label,
html.dark #pageModalCard .notion-property-value label span {
  color: #D4D4D8 !important;
}

.notion-property-value {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Dropdowns, Pickers & Inputs inside Modal */
#pageModalCard input[type="date"],
#pageModalCard input[type="time"],
#pageModalCard select,
#pageReminderSelect,
#pageStartDateInput,
#pageEndDateInput,
#pageStartTimeInput,
#pageEndTimeInput,
.notion-property-input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 13px !important;
  font-weight: 500;
  color: #111827 !important;
  padding: 4px 6px;
  border-radius: 4px;
  outline: none;
  transition: background-color 0.12s ease;
}

html.dark #pageModalCard input[type="date"],
html.dark #pageModalCard input[type="time"],
html.dark #pageModalCard select,
html.dark #pageReminderSelect,
html.dark #pageStartDateInput,
html.dark #pageEndDateInput,
html.dark #pageStartTimeInput,
html.dark #pageEndTimeInput,
html.dark .notion-property-input {
  color: #F4F4F5 !important;
}

.notion-property-input:hover,
.notion-property-input:focus {
  background-color: var(--bg-surface-subtle);
}

/* Section Header: Notes & Comments */
#pageModalCard .modal-section-heading {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: #1F2937 !important;
}

html.dark #pageModalCard .modal-section-heading {
  color: #F4F4F5 !important;
}

.notion-property-menu-btn {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.notion-property-row:hover .notion-property-menu-btn {
  opacity: 1;
}

.notion-status-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s ease, transform 0.08s ease;
  border: none !important;
}

.notion-status-trigger:hover {
  filter: brightness(1.08);
}

.notion-status-trigger:active {
  transform: scale(0.97);
}

.notion-popover-panel {
  position: fixed;
  z-index: 70;
  width: 260px;
  background-color: var(--bg-popover);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.12s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.notion-popover-input {
  width: 100%;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.12s ease;
}

.notion-popover-input:focus {
  border-color: var(--border-hover);
}

.notion-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.notion-popover-row:hover {
  background-color: var(--row-hover);
}

.property-context-menu {
  position: fixed;
  z-index: 75;
  min-width: 180px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.12s ease forwards;
}

.property-context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.property-context-item:hover {
  background-color: var(--row-hover);
  color: var(--text-primary);
}

.property-context-item.danger:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

/* --------------------------------------------------------------------------
   11. Calendar Day Inspector Popover Modal
   -------------------------------------------------------------------------- */
.day-inspector-modal {
  position: fixed;
  z-index: 60;
  width: 360px;
  max-width: 92vw;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.14s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.inspector-event-item {
  padding: 8px 10px;
  border-radius: 8px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  transition: all 0.12s ease;
  cursor: pointer;
}

.inspector-event-item:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface-subtle);
  transform: translateY(-0.5px);
}

/* --------------------------------------------------------------------------
   12. Today's Checklist Item Card
   -------------------------------------------------------------------------- */
.today-task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  transition: opacity 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
  user-select: none;
}

.today-task-card:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface-subtle);
}

.today-task-card.completed {
  opacity: 0.52;
  background-color: var(--row-hover);
  border-color: transparent;
}

.today-task-card.completed .today-task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   13. Master & Scoped Calendar Grid
   -------------------------------------------------------------------------- */
#dashboardCalendarGrid, #smartCalendarGrid, #scopedCalendarGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(92px, auto);
  gap: 5px;
}

.cal-day-cell {
  min-height: 92px;
  height: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0.55rem;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  user-select: none;
  position: relative;
  cursor: pointer;
}

.cal-day-cell:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface-subtle);
}

.cal-day-cell.current-day {
  border-color: var(--text-secondary);
  background-color: var(--bg-surface-subtle);
}

.cal-day-cell.other-month {
  opacity: 0.35;
}

.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cal-add-event-btn {
  opacity: 0;
  padding: 1px 3px;
  border-radius: 3px;
  color: var(--text-muted);
  transition: opacity 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.cal-day-cell:hover .cal-add-event-btn {
  opacity: 1;
}

.cal-add-event-btn:hover {
  color: var(--text-primary);
  background-color: var(--row-hover);
}

.cal-events-container {
  display: flex;
  flex-direction: column;
  gap: 3.5px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   14. Custom Form Elements & Select Controls
   -------------------------------------------------------------------------- */
select.appearance-none {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none !important;
}

.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--border-hover);
  border-radius: 0.25rem;
  background-color: var(--bg-surface);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.1s ease;
  flex-shrink: 0;
}

.custom-checkbox:hover {
  border-color: var(--text-muted);
}

.custom-checkbox:checked {
  background-color: var(--text-primary);
  border-color: var(--text-primary);
}

.custom-checkbox:checked::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background-color: var(--bg-canvas);
}

.custom-checkbox:active {
  transform: scale(0.92);
}

.hub-shortlink-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  transition: all 0.12s ease;
  user-select: none;
  cursor: pointer;
}

.hub-shortlink-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background-color: var(--bg-surface-subtle);
  transform: translateY(-0.5px);
}

/* --------------------------------------------------------------------------
   15. Toast Notification & Widgets
   -------------------------------------------------------------------------- */
.toast-card {
  background-color: #181A20;
  color: #E4E4E7;
  border: 1px solid rgba(63, 63, 70, 0.7);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-slide-in {
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from {
    transform: translateY(12px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   16. Mobile Responsiveness & Touch Optimization
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Sidebar Mobile Drawer */
  #appSidebar {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }

  /* Smooth Touch Momentum Scrolling */
  .table-view-container,
  .timeline-container,
  .project-view-tab-bar,
  #projectTabsList,
  .kanban-grid {
    -webkit-overflow-scrolling: touch;
  }

  /* Project View Tab Bar Mobile Layout */
  .project-view-tab-bar {
    gap: 8px;
    margin-bottom: 1rem;
    padding-bottom: 6px;
  }

  /* Kanban Horizontal Scrolling on Small Screens */
  .kanban-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }

  .kanban-column {
    min-width: 270px;
    max-width: 300px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* Table Grid Touch & Width adjustments */
  .table-view-container {
    width: 100%;
    overflow-x: auto;
  }

  .spreadsheet-table {
    min-width: 600px;
  }

  /* Clean Small Calendar in Mobile View */
  #dashboardCalendarGrid,
  #smartCalendarGrid,
  #scopedCalendarGrid {
    grid-auto-rows: minmax(46px, auto) !important;
    gap: 3px !important;
  }

  .cal-day-cell {
    min-height: 46px !important;
    height: auto !important;
    padding: 3px 4px !important;
    border-radius: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 2px !important;
  }

  .cal-day-header {
    margin-bottom: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .cal-day-header span {
    font-size: 10px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
  }

  .cal-add-event-btn {
    display: none !important;
  }

  .cal-events-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 2.5px !important;
    max-height: 20px !important;
    overflow: hidden !important;
  }

  .cal-events-container .event-pill {
    width: 6px !important;
    height: 6px !important;
    min-width: 6px !important;
    border-radius: 9999px !important;
    padding: 0 !important;
    font-size: 0 !important;
    display: inline-block !important;
    line-height: 0 !important;
    border: none !important;
  }

  .cal-day-cell.current-day {
    border-color: #8B5CF6 !important;
    background-color: rgba(139, 92, 246, 0.08) !important;
  }

  /* Mobile Modals & Popovers */
  #pageModalCard,
  #universalAddModal > div,
  #categoryModal > div,
  #confirmationModal > div,
  #subItemModal > div {
    max-width: calc(100vw - 20px) !important;
    width: 100% !important;
    padding: 1rem !important;
    margin: 0.5rem !important;
    max-height: 92vh !important;
  }

  /* Page Modal Header & Action Buttons */
  .modal-section-heading {
    font-size: 11.5px;
  }

  /* Day Inspector Drawer/Modal on Mobile */
  .day-inspector-modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px !important;
  }

  /* Touch Target Ergonomics */
  button, 
  .sidebar-item-row,
  .project-tab-btn,
  .notion-priority-badge {
    touch-action: manipulation;
  }
}

@media (max-width: 480px) {
  .spreadsheet-table {
    min-width: 520px;
  }

  .timeline-container {
    padding: 8px;
  }

  .timeline-header-days,
  .timeline-row {
    grid-template-columns: 140px repeat(14, minmax(44px, 1fr));
  }
}


