/* Task Items */
.task-item {
  margin-bottom: 1.8rem;
  position: relative;
  z-index: 1; /* establish stacking context */
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(252, 252, 252, 0.3) 100%);
  backdrop-filter: blur(20px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.04),
    0 1px 4px rgba(0, 0, 0, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.task-item:hover {
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(252, 252, 252, 0.4) 100%);
}


@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.task-item.animate-in {
  animation: slideInFromLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.task-item.animate-in:nth-child(1) { animation-delay: 0.5s; }
.task-item.animate-in:nth-child(2) { animation-delay: 0.6s; }
.task-item.animate-in:nth-child(3) { animation-delay: 0.7s; }
.task-item.animate-in:nth-child(4) { animation-delay: 0.8s; }
.task-item.animate-in:nth-child(n+5) { animation-delay: 0.9s; }

.task-item::before {
  display: none;
}

.task-item:first-child::before {
  display: none;
}

.task-item:last-child {
  margin-bottom: 0;
}

/* Compact View Styles */
.task-item.compact {
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  cursor: pointer;
}

.task-item.compact:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}


.compact-task-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.compact-task-line .task-status-badge {
  font-size: 0.9rem;
  margin-right: 0;
  opacity: 0.8;
}

.compact-task-line .task-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #1a1a1a;
  flex: 1;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.compact-task-line .task-category {
  font-size: 0.75rem;
  color: #888;
  font-weight: 400;
}

.compact-task-line .task-progress {
  font-size: 0.75rem;
  color: #7f8c8d;
  font-weight: 500;
  background: rgba(127, 140, 141, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.expand-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #999;
  cursor: pointer;
  padding: 0.25rem;
  user-select: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.expand-arrow:hover {
  color: #666;
  background: rgba(0, 0, 0, 0.05);
}

.expand-arrow:active {
  background: rgba(0, 0, 0, 0.1);
}

.expand-arrow-icon {
  width: 16px;
  height: 16px;
  display: block;
}

/* Subtasks styling when expanded */
.task-item .subtask-list {
  display: block;
  margin-top: 0.5rem;
  margin-left: 0;
  padding-left: 0.5rem;
  border-left: 2px solid rgba(0, 0, 0, 0.05);
}


/* Task menu button */
.task-menu-btn {
  background: transparent;
  color: #999;
  border: none;
  padding: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.task-menu-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #666;
}

/* Task menu dropdown */
.task-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999; /* ensure above other tasks */
  min-width: 120px;
  padding: 0.5rem 0;
  overflow: hidden;
}

/* Mobile modal variant when portalized to body */
.task-menu-dropdown.mobile-modal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  transform: translate(-50%, -50%) !important;
  min-width: 80vw !important;
  max-width: 92vw !important;
  z-index: 100001 !important;
}

.task-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: #333;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}

.task-menu-dropdown button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.task-menu-dropdown button:first-child {
  border-radius: 16px 16px 0 0;
}

.task-menu-dropdown button:last-child {
  border-radius: 0 0 16px 16px;
}

.task-menu-dropdown button:only-child {
  border-radius: 16px;
}

/* Task menu empty state */
.task-menu-dropdown .menu-empty {
  padding: 0.6rem 1rem;
  color: #999;
  font-size: 0.85rem;
  text-align: center;
}

.task-menu-dropdown button[data-action="delete-task"] {
  color: #dc3545;
}

.task-menu-dropdown button[data-action="delete-task"]:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #c82333;
}

/* Habit menu button (reusing task menu styles) */
.habit-menu-btn {
  background: transparent;
  color: #999;
  border: none;
  padding: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.habit-menu-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #666;
}

/* Habit menu dropdown (reusing task menu styles) */
.habit-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999; /* ensure above other habits */
  min-width: 120px;
  padding: 0.5rem 0;
  overflow: hidden;
}

/* Mobile modal variant when portalized to body */
.habit-menu-dropdown.mobile-modal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  transform: translate(-50%, -50%) !important;
  min-width: 80vw !important;
  max-width: 92vw !important;
  z-index: 100001 !important;
}

.habit-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: #333;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}

.habit-menu-dropdown button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.habit-menu-dropdown button:first-child {
  border-radius: 16px 16px 0 0;
}

.habit-menu-dropdown button:last-child {
  border-radius: 0 0 16px 16px;
}

.habit-menu-dropdown button:only-child {
  border-radius: 16px;
}

.habit-menu-dropdown button[data-action="delete-habit"] {
  color: #dc3545;
}

.habit-menu-dropdown button[data-action="delete-habit"]:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #c82333;
}

/* Task description */
.task-description-collapsed {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.task-description-collapsed .task-description {
  font-size: 0.9rem;
  color: #555;
  margin: 0.25rem 0 0;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.03); /* subtle background */
  border: none;
  border-radius: 0;
  line-height: 1.5;
}

.task-description-container {
  margin-top: 0.5rem;
}

.task-description {
  font-size: 0.9rem;
  color: #555;
  margin: 0.25rem 0 0;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.03); /* subtle background */
  border: none;
  border-radius: 0;
  line-height: 1.5;
}

.main-task {
  font-weight: 350;
  color: #1a1a1a;
  min-width: 0; /* Critical: allows flex children to shrink below content size */
  width: 100%;
}

.main-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  min-width: 0; /* Critical: allows flex children to shrink below content size */
  width: 100%;
}

.task-title {
  flex: 1 1 0%;
  min-width: 0;
  width: 0; /* Force flex item to respect min-width: 0 and shrink */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.task-title > .task-status-badge {
  flex-shrink: 0;
}

.task-title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* When a task is expanded, allow the title to wrap to show full text */
.task-item.expanded .task-title {
  width: auto; /* Allow full width when expanded for wrapping */
  overflow: visible;
}

.task-item.expanded .task-title-text {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

/* Reduce margins for collapsed tasks */
.task-item.collapsed {
  margin-bottom: 0.25rem;
}

.task-item.collapsed.compact {
  margin-bottom: 0.2rem;
}

.task-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

/* removed decorative line under main task header */

.task-meta {
  margin: 0.2rem 0 0.7rem 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: #888;
  font-size: 0.8rem;
  min-height: 1.5rem;
}

.subtasks-footer .task-add-note-btn {
  /* Inherits styles from .subtasks-footer .btn.add-task */
  /* Additional specific styles can be added here if needed */
}

/* Minimal style for Add Subtask button when placed below subtasks */
.subtasks-footer .btn.add-task {
  background: transparent;
  border: none;
  color: #7f8c8d;
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  min-height: 28px;
  box-shadow: none;
}

.subtasks-footer .btn.add-task:hover {
  background: transparent;
  color: #586b6c;
}

.subtasks-footer {
  margin: 0.4rem 0 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Make inline Add Subtask action subtle when placed inside task-meta */
.task-meta .btn.add-task {
  background: transparent;
  border: none;
  color: #7f8c8d;
  padding: 0 0.25rem;
  font-size: 0.7rem;
  line-height: 1;
  text-decoration: underline dotted;
  box-shadow: none;
  transform: none;
  opacity: 0.85;
}

.task-meta .btn.add-task:hover {
  background: transparent;
  border: none;
  color: #586b6c;
  text-decoration: underline;
  box-shadow: none;
  transform: none;
  opacity: 1;
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  margin-left: auto;
  visibility: hidden;
  align-items: center;
  align-self: center;
}

.task-meta:hover .task-actions {
  opacity: 1;
  visibility: visible;
}

.task-badge {
  color: #888;
  font-size: 0.75rem;
  font-weight: 400;
}

.task-title {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  margin-bottom: 0;
  color: #1a1a1a;
  letter-spacing: 0.01em;
  font-feature-settings: 'kern' 1, 'liga' 1, 'ss01' 1, 'ss02' 1;
  position: relative;
  outline: none;
  border-radius: 4px;
  padding: 0.2rem 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  font-variant-ligatures: common-ligatures;
}

.task-title:focus {
  box-shadow: 0 0 0 2px rgba(200, 190, 180, 0.3);
  background: rgba(200, 190, 180, 0.05);
}

.task-title:hover {
  color: #8b7d6b;
  text-shadow: 0 1px 2px rgba(139, 125, 107, 0.1);
}

.task-title::before {
  display: none;
}

.subtask-number {
  color: #999;
  background: transparent;
}

.task-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  margin-right: 0.5rem;
  opacity: 0.7;
  cursor: pointer;
}

.task-status-badge:hover {
  opacity: 1;
}

/* Habit icon before repeat icon for habit tasks */
.task-habit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #ff9800; /* orange tone for habits */
  opacity: 0.9;
  margin-right: 0.25rem;
}

.task-habit-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Repeat icon before recurring task titles */
.task-repeat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #27ae60; /* success tone */
  opacity: 0.9;
}

.task-repeat-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* When icon is placed after the title, add left spacing */
.task-title .task-repeat-icon {
  margin-left: 0.35rem;
  margin-right: 0;
}

/* Recurring progress style in actions */
.task-recurring-progress {
  white-space: nowrap;
}

.task-progress {
  font-size: 0.7rem;
  color: #7f8c8d;
  font-weight: 500;
  margin-left: 0.3rem;
  white-space: nowrap;
}

.status-done {
  color: #27ae60;
}

.status-defined {
  color: #f39c12;
}

.status-new {
  color: #1976d2;
}

/* Subtasks */
.subtask-list {
  margin: 1rem 0 0.75rem 0;
  padding-left: 0.8rem;
  border-left: none;
  background: transparent;
  position: relative;
}

.subtask-list::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, 
    rgba(120, 120, 120, 0.22) 0%,
    rgba(25, 118, 210, 0.38) 50%,
    rgba(120, 120, 120, 0.22) 100%);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(25, 118, 210, 0.12);
}

.subtask-item {
  margin-bottom: 0.5rem;
  padding: 0.1rem 0;
  position: relative;
}

.subtask-item::before {
  content: '';
  position: absolute;
  left: -1.125rem;
  top: 0.75rem;
  width: 8px;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent);
  opacity: 0.8;
  border-radius: 0.5px;
}

.subtask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 1.2rem;
}

.subtask-title-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}

.subtask-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
  align-self: center;
}

.subtask-text {
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #555;
  font-weight: 400;
}

.subtask-text.completed {
  text-decoration: line-through;
  color: #bbb;
  opacity: 0.7;
}

.subtask-text.new {
  color: #999;
  font-style: italic;
  opacity: 0.7;
}

.subtask-text.new em {
  font-style: italic;
  color: #999;
}

.subtask-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  font-size: 0.5rem;
  font-weight: 500;
  margin-right: 0.75rem;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.subtask-status.pending {
  color: #ccc;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.subtask-status.pending::after {
  display: none;
}



.subtask-status.completed {
  color: white;
  background: #5A8F76;
  border: 1px solid #4a7a61;
  box-shadow: 0 1px 3px rgba(90, 143, 118, 0.3);
}

.subtask-status.completed::after {
  content: '✓';
  position: absolute;
  font-size: 9px;
  font-weight: 600;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}


/* Subtask inline editor - minimal design */
.subtask-edit-container {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  flex-wrap: wrap;
}

.subtask-edit-input {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #1a1a1a;
  font-weight: 400;
  padding: 0.25rem 0.4rem;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  background: white;
  min-height: 32px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: all 0.2s;
}

.subtask-edit-input:focus {
  outline: none;
  border-color: #c8b8a8;
  box-shadow: 0 0 0 1px rgba(200, 190, 180, 0.2);
  background: white;
}

.subtask-edit-controls {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.subtask-save-btn {
  background: #27ae60;
  color: white;
  border: none;
  padding: 0.2rem 0.5rem;
  min-height: 32px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  font-family: inherit;
  border-radius: 4px;
}

.subtask-save-btn:hover,
.subtask-save-btn:active {
  background: #229954;
}

.subtask-save-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.3);
}

/* Ensure text area is tappable */
.subtask-text {
  cursor: pointer;
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
}


.add-subtask-btn {
  margin: 0.3rem 0 0 1rem;
}

.add-subtask-btn .btn {
  background: transparent;
  color: #aaa;
  border: none;
  padding: 0.25rem 0;
  font-size: 0.75rem;
  text-decoration: none;
  font-weight: 400;
}

.add-subtask-btn .btn:hover {
  color: #666;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: #7f8c8d;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: #95a5a6;
}

.empty-state p {
  margin-bottom: 1.5rem;
}

.empty-state-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.empty-state-actions .btn {
  min-width: 140px;
}

/* Stats */
.stats {
  margin-bottom: 2rem;
  color: #666;
  font-size: 0.9rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  line-height: 1.6;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(252, 252, 252, 0.8) 50%, rgba(248, 248, 248, 0.7) 100%);
  backdrop-filter: blur(30px) saturate(1.3);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.08),
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 1px 4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

.stats:hover {
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Phase complete state - clickable */
.stats.phase-complete {
  cursor: pointer;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(252, 252, 252, 0.9) 50%, rgba(248, 248, 248, 0.85) 100%);
  border-color: rgba(39, 174, 96, 0.2);
  box-shadow: 
    0 12px 40px rgba(39, 174, 96, 0.12),
    0 4px 16px rgba(39, 174, 96, 0.08),
    0 1px 4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(39, 174, 96, 0.05);
}

.stats.phase-complete:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 16px 48px rgba(39, 174, 96, 0.16),
    0 6px 20px rgba(39, 174, 96, 0.12),
    0 2px 6px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(39, 174, 96, 0.1);
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(252, 252, 252, 0.95) 50%, rgba(248, 248, 248, 0.9) 100%);
}

.stats.phase-complete:active {
  transform: translateY(-1px);
  box-shadow: 
    0 8px 24px rgba(39, 174, 96, 0.14),
    0 3px 10px rgba(39, 174, 96, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.stats.phase-complete .progress {
  color: #27ae60;
}

.stats.phase-complete .details {
  color: #2ecc71;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.stats-buttons {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stats-start-phase-btn {
  background: #f5f7f9;
  color: #666;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: inline-block;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.stats-start-phase-btn:hover {
  background: #eef2f5;
  color: #333;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.stats-start-phase-btn:active {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stats-dismiss-btn {
  background: transparent;
  color: #999;
  border: none;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  letter-spacing: 0.01em;
  font-family: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
}

.stats-dismiss-btn:hover {
  color: #666;
  text-decoration-color: #999;
  background: rgba(0, 0, 0, 0.03);
}

.stats-dismiss-btn:active {
  color: #555;
  background: rgba(0, 0, 0, 0.05);
}

/* Focus Mode uses the same minimal design as date-group-header (defined in due-date plugin) */

.stats::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.8) 50%, transparent 100%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.stats-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.stats-text {
  flex: 1;
}

.progress {
  color: #1a1a1a;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-feature-settings: 'kern' 1, 'tnum' 1, 'ss01' 1;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.details {
  color: #888;
  font-size: 0.75rem;
  line-height: 1.4;
  font-style: normal;
  opacity: 0.8;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.pie-chart {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: conic-gradient(#27ae60 0deg, #f0f0f0 0deg);
  position: relative;
  flex-shrink: 0;
  opacity: 0.9;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(39, 174, 96, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.pie-chart:hover {
  transform: scale(1.08) rotate(8deg);
  box-shadow: 0 6px 12px rgba(39, 174, 96, 0.25), 0 3px 6px rgba(0, 0, 0, 0.12);
  animation: chart-bounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes chart-bounce {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1.08) rotate(8deg); }
}

.pie-chart:hover {
  opacity: 1;
}

.pie-chart::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Mobile Styles */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  /* Mobile modal for task menu */
  .task-item .task-menu-dropdown {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    min-width: 80vw !important;
    max-width: 92vw !important;
    z-index: 99999 !important;
  }

  .menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    z-index: 10000;
  }

  body.no-scroll {
    overflow: hidden;
    touch-action: none;
  }
  
  .container {
    padding: 1.5rem 0.75rem 1rem;
  }
  
  .header {
    margin-bottom: 2rem;
  }
  
  .header h1 {
    font-size: 1.4rem;
  }
  
  .phases {
    display: flex;
    gap: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.75rem 0;
  }
  
  .phases::-webkit-scrollbar {
    display: none;
  }
  
  .phase-btn {
    margin-right: 1rem;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    display: inline-block;
    border-radius: 4px;
    min-height: 2.5rem;
  }
  
  .stats {
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
  }
  
  .stats-container {
    flex-direction: row;
    gap: 1rem;
    text-align: left;
    align-items: flex-start;
  }
  
  .progress {
    font-size: 0.9rem;
  }
  
  .details {
    font-size: 0.75rem;
  }
  
  .pie-chart {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
  
  .pie-chart::before {
    width: 12px;
    height: 12px;
  }
  
  .controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    margin-bottom: 0;
    gap: 0.6rem;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    justify-content: space-between;
    display: flex;
  }
  
  .controls::-webkit-scrollbar {
    display: none;
  }
  
  .controls .btn {
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  .controls .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-height: 40px;
  }
  
  .view-toggle-icon {
    width: 40px;
    height: 40px;
  }
  
  .view-toggle-btn {
    padding: 0.25rem 0.5rem;
  }
  
  .filters {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.25rem 0;
  }
  
  .filters::-webkit-scrollbar {
    display: none;
  }
  
  .filter-btn {
    padding: 0.05rem 0;
    font-size: 0.7rem;
    margin-right: 1.25rem;
    flex-shrink: 0;
    white-space: nowrap;
    display: inline;
  }
  
  .todo-tree {
    padding: 0 0 5rem 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  
  .task-item {
    margin-bottom: 1.5rem;
    padding: 0.25rem 0.5rem;
  }
  
  .main-task-header {
    display: flex;
    align-items: center;
    position: relative;
    min-width: 0; /* Critical: allows flex children to shrink below content size */
    width: 100%;
  }

  .task-header-actions {
    position: absolute !important;
    right: 0;
    top: 0;
    flex-shrink: 0;
    z-index: 2;
  }

  .task-title {
    flex: 1 1 0%;
    min-width: 0;
    width: 0; /* Force flex item to respect min-width: 0 and shrink */
  }

  .task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    margin: 0.25rem 0 1rem 0;
    padding-left: 0;
    align-items: center;
  justify-content: flex-end;
  }

  .task-actions {
    opacity: 1;
    visibility: visible;
    margin-left: auto;
    order: 10;
  }
  
  .task-title {
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
    flex: 1 1 0%;
    min-width: 0;
    width: 0; /* Force flex item to respect min-width: 0 and shrink */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
  }

  .task-title > .task-status-badge {
    flex-shrink: 0;
  }

  .task-title-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .task-badge {
    font-size: 0.75rem;
    padding: 0.05rem 0.3rem;
  }
  
  .task-status {
    font-size: 0.65rem;
    margin-top: 0.2rem;
    width: 100%;
  }
  
  .subtask-list {
    margin: 0.8rem 0 0.6rem 0;
  }
  
  .subtask-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .subtask-actions {
    opacity: 1;
    visibility: visible;
    flex-shrink: 0;
    order: 0;
  }

  .subtask-id {
    font-size: 0.6rem;
    min-width: 25px;
  }
  
  .subtask-text {
    font-size: 0.75rem;
    line-height: 1.3;
    word-break: break-word;
  }
  
  .edit-btn, .delete-btn {
    padding: 0.1rem 0.25rem;
    font-size: 0.7rem;
    min-height: 28px;
    opacity: 1;
    visibility: visible;
    border-radius: 3px;
  }
  
  .add-subtask-btn {
    margin: 0.3rem 0 0 0.6rem;
  }
  
  .add-subtask-btn .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    min-height: 32px;
  }
  
  .right-panel-container {
    position: static;
    margin: 0.5rem 0 1rem 0;
    width: 100%;
  }
  
  .right-panel-toggle {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* Mobile habit tracker */
  .habit-dates-header {
    grid-template-columns: 80px repeat(7, 28px);
    gap: 0.2rem;
  }

  .habit-days {
    grid-template-columns: repeat(7, 28px);
    gap: 0.2rem;
  }

  .habit-day-btn {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .habit-date {
    height: 32px;
    padding: 0.1rem;
  }

  .habit-date-day {
    font-size: 0.7rem;
  }

  /* Show abbreviated weekday names on mobile */
  .habit-date-weekday {
    font-size: 0 !important;
    font-weight: 600;
    position: relative;
  }

  .habit-date-weekday::before {
    content: attr(data-short);
    font-size: 0.5rem !important;
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, 0%);
    width: auto;
    text-align: center;
  }
}

