/* ============================================================
   Dozhen Web App — reusable components
   Scoped under body.web-mode.
   ============================================================ */

/* ---------- Dashboard hero ---------- */

body.web-mode .dashboard-hero {
  margin-bottom: 20px;
}

body.web-mode .dashboard-hello {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

body.web-mode .dashboard-loading {
  padding: 40px;
  text-align: center;
  color: #6b7280;
}

/* ---------- Stat grid ---------- */

body.web-mode .stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

body.web-mode .stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.web-mode .stat-card-emoji {
  font-size: 22px;
}

body.web-mode .stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}

body.web-mode .stat-card-label {
  font-size: 13px;
  color: #6b7280;
}

@media (max-width: 1024px) {
  body.web-mode .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  body.web-mode .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Dashboard sections ---------- */

body.web-mode .dashboard-section {
  margin-bottom: 28px;
}

body.web-mode .dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

body.web-mode .dashboard-section-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

body.web-mode .dashboard-section-header a {
  color: #4f46e5;
  text-decoration: none;
}

body.web-mode .dashboard-section-header a:hover {
  text-decoration: underline;
}

body.web-mode .empty-hint {
  padding: 20px;
  background: #fafbfc;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  color: #6b7280;
  font-size: 13px;
}

body.web-mode .empty-hint a {
  color: #4f46e5;
  text-decoration: underline;
}

body.web-mode .dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  body.web-mode .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

/* ---------- Project grid + card ---------- */

body.web-mode .project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1024px) {
  body.web-mode .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  body.web-mode .project-grid {
    grid-template-columns: 1fr;
  }
}

body.web-mode .project-card {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

body.web-mode .project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

body.web-mode .project-card-bar {
  height: 4px;
}

body.web-mode .project-card-body {
  padding: 14px 16px 16px;
}

body.web-mode .project-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.web-mode .project-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

body.web-mode .project-card-desc {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* ---------- Task list rows ---------- */

body.web-mode .task-list {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

body.web-mode .task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  text-decoration: none;
  font-size: 13px;
}

body.web-mode .task-row:last-child {
  border-bottom: none;
}

body.web-mode .task-row:hover {
  background: #f9fafb;
}

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

body.web-mode .task-row-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  font-size: 12px;
  color: #6b7280;
}

body.web-mode .task-row-project {
  background: #eef2ff;
  color: #4338ca;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

/* ---------- Activity feed ---------- */

body.web-mode .activity-list {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

body.web-mode .activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  text-decoration: none;
  font-size: 13px;
}

body.web-mode .activity-row:last-child {
  border-bottom: none;
}

body.web-mode .activity-row:hover {
  background: #f9fafb;
}

body.web-mode .activity-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

body.web-mode .activity-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

body.web-mode .activity-time {
  flex-shrink: 0;
  font-size: 11px;
  color: #9ca3af;
}

/* ---------- Page header (list pages) ---------- */

body.web-mode .page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

body.web-mode .page-header-main {
  min-width: 0;
}

body.web-mode .page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}

body.web-mode .page-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

body.web-mode .page-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- View-mode toggle (grid vs tree) ---------- */

body.web-mode .view-toggle {
  display: inline-flex;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  margin-right: 8px;
}

body.web-mode .view-toggle-btn {
  background: #fff;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
}

body.web-mode .view-toggle-btn:last-child {
  border-right: none;
}

body.web-mode .view-toggle-btn:hover {
  background: #f9fafb;
}

body.web-mode .view-toggle-btn--active {
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
}

/* ---------- Tree list ---------- */

body.web-mode .tree-list {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

body.web-mode .tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-right: 12px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.08s;
}

body.web-mode .tree-row:last-child {
  border-bottom: none;
}

body.web-mode .tree-row:hover {
  background: #f9fafb;
}

body.web-mode .tree-caret {
  background: none;
  border: none;
  width: 22px;
  height: 22px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  flex-shrink: 0;
}

body.web-mode .tree-caret:hover:not(.tree-caret--leaf) {
  background: #e5e7eb;
}

body.web-mode .tree-caret--leaf {
  cursor: default;
  color: transparent;
}

body.web-mode .tree-row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1f2937;
  padding: 2px 0;
}

body.web-mode .tree-row-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .tree-row-count {
  font-size: 10px;
  background: #f3f4f6;
  color: #6b7280;
  padding: 1px 7px;
  border-radius: 999px;
}

body.web-mode .tree-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  flex-shrink: 0;
}

body.web-mode .tree-fav-btn:hover {
  transform: scale(1.1);
}

/* ---------- Category filter bar + badges ---------- */

body.web-mode .cat-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

body.web-mode .cat-filter-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
  transition: all 0.1s;
  border-left: 3px solid var(--cat-color, #9ca3af);
}

body.web-mode .cat-filter-btn:hover {
  background: #f3f4f6;
}

body.web-mode .cat-filter-btn--active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

body.web-mode .cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: color-mix(in srgb, var(--cat-color, #9ca3af) 15%, #fff);
  color: var(--cat-color, #374151);
  border: 1px solid color-mix(in srgb, var(--cat-color, #9ca3af) 35%, #fff);
  margin-right: 4px;
  margin-top: 4px;
}

body.web-mode .cat-badge--sm {
  font-size: 10px;
  padding: 1px 6px;
}

/* ---------- Category sections (grouped project list) ---------- */

body.web-mode .cat-section {
  margin-bottom: 28px;
}

body.web-mode .cat-section:last-child {
  margin-bottom: 0;
}

body.web-mode .cat-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

body.web-mode .cat-section-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

body.web-mode .cat-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
}

body.web-mode .cat-section-count {
  font-size: 12px;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 10px;
}

body.web-mode .cat-section-empty {
  grid-column: 1 / -1;
  padding: 20px;
  text-align: center;
  color: #d1d5db;
  font-size: 13px;
  border: 2px dashed #e5e7eb;
  border-radius: 10px;
}

body.web-mode .cat-section--dragover {
  background: #eef2ff;
  border-radius: 12px;
  outline: 2px dashed #6366f1;
  outline-offset: -2px;
}

body.web-mode .cat-section--dragover .cat-section-empty {
  border-color: #6366f1;
  color: #6366f1;
}

body.web-mode .project-card-wrapper[draggable] {
  cursor: grab;
}

body.web-mode .project-card-wrapper[draggable]:active {
  cursor: grabbing;
}

body.web-mode .project-card-wrapper.dragging {
  opacity: 0.4;
}

body.web-mode .project-card-cats {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- Project card favorite button overlay ---------- */

body.web-mode .project-card-wrapper {
  position: relative;
}

body.web-mode .fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  transition: transform 0.1s;
  z-index: 1;
}

body.web-mode .fav-btn:hover {
  transform: scale(1.1);
}

/* ---------- Data table (my-tasks / project todos) ---------- */

body.web-mode .data-table {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

body.web-mode .data-table-head,
body.web-mode .data-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 80px 60px 80px minmax(0, 1.2fr);
  gap: 12px;
  padding: 10px 14px;
  align-items: center;
  font-size: 13px;
}

body.web-mode .data-table-head {
  background: #f9fafb;
  font-weight: 600;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #e5e7eb;
}

body.web-mode .data-row {
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  text-decoration: none;
  transition: background 0.08s;
}

body.web-mode .data-row:last-child {
  border-bottom: none;
}

body.web-mode .data-row:hover {
  background: #f9fafb;
}

body.web-mode .data-row .col-title {
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .data-row .col-due--overdue {
  color: #dc2626;
  font-weight: 600;
}

/* Status + priority pills */

body.web-mode .status-pill,
body.web-mode .priority-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

body.web-mode .status-pill.status-todo {
  background: #f3f4f6;
  color: #4b5563;
}

body.web-mode .status-pill.status-in_progress {
  background: #dbeafe;
  color: #1d4ed8;
}

body.web-mode .status-pill.status-done {
  background: #d1fae5;
  color: #065f46;
}

body.web-mode .priority-pill.priority-low {
  background: #f3f4f6;
  color: #6b7280;
}

body.web-mode .priority-pill.priority-medium {
  background: #fef3c7;
  color: #92400e;
}

body.web-mode .priority-pill.priority-high {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 900px) {
  body.web-mode .data-table-head,
  body.web-mode .data-row {
    grid-template-columns: minmax(0, 2fr) 70px 80px;
  }
  body.web-mode .data-table-head .col-priority,
  body.web-mode .data-row .col-priority,
  body.web-mode .data-table-head .col-project,
  body.web-mode .data-row .col-project,
  body.web-mode .data-table-head .col-assignee,
  body.web-mode .data-row .col-assignee {
    display: none;
  }
}

/* ---------- My tasks groups ---------- */

body.web-mode .mt-group {
  margin-bottom: 24px;
}

body.web-mode .mt-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

body.web-mode .mt-group-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

body.web-mode .mt-group-emoji {
  font-size: 16px;
}

body.web-mode .mt-group-count {
  font-size: 11px;
  background: #e5e7eb;
  color: #4b5563;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---------- Doc grid ---------- */

body.web-mode .doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 700px) {
  body.web-mode .doc-grid {
    grid-template-columns: 1fr;
  }
}

body.web-mode .doc-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}

body.web-mode .doc-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

body.web-mode .doc-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

body.web-mode .doc-card-body {
  min-width: 0;
  flex: 1;
}

body.web-mode .doc-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .doc-card-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

/* ---------- File grid ---------- */

body.web-mode .file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

body.web-mode .file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

body.web-mode .file-card-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border-radius: 8px;
  flex-shrink: 0;
}

body.web-mode .file-card-body {
  min-width: 0;
  flex: 1;
}

body.web-mode .file-card-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .file-card-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

body.web-mode .file-card-dl {
  background: #f3f4f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

body.web-mode .file-card-dl:hover {
  background: #4f46e5;
  color: #fff;
}

body.web-mode .file-card-dl:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.web-mode .file-card--with-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

body.web-mode .file-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body.web-mode .file-card-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}

/* ---------- Buttons ---------- */

body.web-mode .btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  transition: all 0.1s;
}

body.web-mode .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

body.web-mode .btn-outline {
  background: #fff;
  border-color: #d1d5db;
  color: #374151;
}

body.web-mode .btn-outline:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

body.web-mode .btn-primary {
  background: #4f46e5;
  color: #fff;
}

body.web-mode .btn-primary:hover {
  background: #4338ca;
}

/* ---------- Utility ---------- */

body.web-mode .text-sm {
  font-size: 13px;
}

body.web-mode .text-secondary {
  color: #6b7280;
}

body.web-mode .empty-state {
  padding: 48px 24px;
  text-align: center;
}

body.web-mode .empty-state-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

body.web-mode .stat-card--clickable {
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

body.web-mode .stat-card--clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* ============================================================
   Project structure (architecture diagram)
   ============================================================ */

body.web-mode .structure-canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 8px;
  flex-wrap: wrap;
}

body.web-mode .structure-pick-indicator {
  font-size: 12px;
  color: #4338ca;
  background: #eef2ff;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
}

body.web-mode .structure-viewport {
  position: relative;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 480px;
  overflow: auto;
  background:
    linear-gradient(#f8fafc, #f8fafc),
    radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
  background-blend-mode: multiply;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  user-select: none;
}

body.web-mode .structure-world {
  position: relative;
}

body.web-mode .structure-edges {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

body.web-mode .structure-edges .edge {
  pointer-events: auto;
}

body.web-mode .structure-edges .edge--tree path {
  stroke: #94a3b8;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

body.web-mode .structure-edges .edge--dep path {
  stroke: #6366f1;
  stroke-width: 2;
  cursor: pointer;
}

body.web-mode .structure-edges .edge--dep:hover path {
  stroke: #dc2626;
  stroke-width: 3;
}

body.web-mode .structure-edges .edge-label {
  font-size: 11px;
  fill: #4338ca;
  font-weight: 600;
}

body.web-mode .structure-nodes {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

body.web-mode .structure-node {
  position: absolute;
  background: #fff;
  border: 2px solid var(--node-color, #94a3b8);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  cursor: grab;
  overflow: hidden;
  transition: box-shadow 0.1s, transform 0.1s;
}

body.web-mode .structure-node:hover {
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.2);
}

body.web-mode .structure-node.dragging {
  cursor: grabbing;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
  z-index: 10;
}

body.web-mode .structure-node.pick-from {
  outline: 2px dashed #6366f1;
  outline-offset: 3px;
}

body.web-mode .structure-node--root {
  border-width: 3px;
  background: linear-gradient(180deg, #fff 0%, #f9fafb 100%);
}

body.web-mode .structure-node-stripe {
  height: 4px;
  background: var(--node-color, #94a3b8);
}

body.web-mode .structure-node-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

body.web-mode .structure-node-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.web-mode .structure-node--root .structure-node-name {
  font-size: 14px;
}

body.web-mode .structure-node-count {
  flex-shrink: 0;
  font-size: 11px;
  color: #4b5563;
  background: color-mix(in srgb, var(--node-color, #94a3b8) 14%, #fff);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* Task nodes on canvas */

body.web-mode .structure-task {
  position: absolute;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--task-color, #9ca3af);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: grab;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s;
  overflow: hidden;
}

body.web-mode .structure-task:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 2;
}

body.web-mode .structure-task-status {
  font-size: 10px;
  font-weight: 600;
  color: var(--task-color, #9ca3af);
  margin-bottom: 2px;
  text-transform: uppercase;
}

body.web-mode .structure-task-title {
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.web-mode .edge-task-line {
  stroke: #d1d5db;
  stroke-width: 1;
  stroke-dasharray: 4 3;
  fill: none;
}

body.web-mode .edge-subtask-line {
  stroke: #94a3b8;
  stroke-width: 1.5;
  fill: none;
  opacity: 0.75;
}

body.web-mode .structure-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  margin-left: 12px;
}

body.web-mode .structure-toggle input {
  cursor: pointer;
}

/* ============================================================
   Phase 5 — Split view (my-tasks + project todos)
   ============================================================ */

body.web-mode .split-view {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  align-items: start;
  min-height: 0;
}

@media (max-width: 1024px) {
  body.web-mode .split-view {
    grid-template-columns: 1fr;
  }
  body.web-mode .split-detail {
    display: none;
  }
  /* On narrow screens with a selection, hide the list and show the
     detail. The route re-renders on ?task=, so the JS decides which
     pane is visible via a body class (set below). */
  body.web-mode.split-showing-detail .split-list {
    display: none;
  }
  body.web-mode.split-showing-detail .split-detail {
    display: block;
  }
}

body.web-mode .split-list {
  min-width: 0;
}

body.web-mode .split-detail {
  min-width: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  position: sticky;
  top: 76px; /* top-bar height + gap */
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

body.web-mode .split-detail .empty-state {
  padding: 60px 24px;
}

/* Task list rows inside the left pane */

body.web-mode .split-task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.web-mode .split-task-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #1f2937;
  text-decoration: none;
  transition: border-color 0.1s, background 0.1s;
}

body.web-mode .split-task-row:hover {
  border-color: #c7d2fe;
  background: #fafbff;
}

body.web-mode .split-task-row--selected {
  border-color: #4f46e5;
  background: #eef2ff;
  box-shadow: 0 0 0 1px #4f46e5;
}

body.web-mode .split-task-title {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

body.web-mode .split-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}

/* Detail panel content */

body.web-mode .detail-panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f3f4f6;
}

body.web-mode .detail-panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

body.web-mode .detail-panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

body.web-mode .detail-panel-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

body.web-mode .detail-panel-actions .btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  text-decoration: none;
}

body.web-mode .detail-panel-actions .btn-icon:hover {
  background: #f9fafb;
  border-color: #c7d2fe;
}

body.web-mode .detail-panel-actions .btn-icon--danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

body.web-mode .detail-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

body.web-mode .detail-panel-meta .meta-item {
  color: #6b7280;
}

body.web-mode .detail-panel-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

body.web-mode .tag-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

body.web-mode .detail-panel-content {
  padding: 18px 20px;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
}

body.web-mode .detail-panel-content h1,
body.web-mode .detail-panel-content h2,
body.web-mode .detail-panel-content h3 {
  margin-top: 18px;
  margin-bottom: 10px;
  color: #111827;
}

body.web-mode .detail-panel-content h1 { font-size: 20px; }
body.web-mode .detail-panel-content h2 { font-size: 17px; }
body.web-mode .detail-panel-content h3 { font-size: 15px; }

body.web-mode .detail-panel-content p {
  margin: 0 0 12px;
}

body.web-mode .detail-panel-content pre {
  background: #f3f4f6;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12px;
}

body.web-mode .detail-panel-content code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

body.web-mode .detail-panel-content pre code {
  background: transparent;
  padding: 0;
}

body.web-mode .detail-panel-content ul,
body.web-mode .detail-panel-content ol {
  padding-left: 22px;
  margin: 0 0 12px;
}

body.web-mode .detail-panel-content img {
  max-width: 100%;
  border-radius: 6px;
}

body.web-mode .detail-panel-subtasks,
body.web-mode .detail-panel-checklist,
body.web-mode .detail-panel-attachments {
  padding: 12px 20px 20px;
  border-top: 1px solid #f3f4f6;
}

body.web-mode .detail-panel-subtasks-header {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

body.web-mode .subtask-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.web-mode .subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fafbfc;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  color: #1f2937;
  text-decoration: none;
  font-size: 12px;
}

body.web-mode .subtask-row:hover {
  background: #f3f4f6;
}

body.web-mode .subtask-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

body.web-mode .subtask-status.status-todo { background: #f3f4f6; color: #4b5563; }
body.web-mode .subtask-status.status-in_progress { background: #dbeafe; color: #1d4ed8; }
body.web-mode .subtask-status.status-done { background: #d1fae5; color: #065f46; }

body.web-mode .subtask-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .subtask-due {
  flex-shrink: 0;
  color: #9ca3af;
  font-size: 10px;
}

body.web-mode .text-danger {
  color: #dc2626;
}

/* ============================================================
   Home timeline (time river)
   ============================================================ */

body.web-mode .timeline-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 28px;
}

body.web-mode .timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f3f4f6;
}

body.web-mode .timeline-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

body.web-mode .timeline-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.web-mode .timeline-body {
  display: flex;
  align-items: stretch;
  min-height: 320px;
}

body.web-mode .timeline-viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 320px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  /* Blue-green river gradient background */
  background:
    linear-gradient(180deg,
      #f8fafc 0%,
      #f0f9ff 60%,
      #dbeafe 85%,
      #bfdbfe 100%);
}

/* ---------- Island (unscheduled tasks) ---------- */

body.web-mode .timeline-island {
  flex: 0 0 210px;
  max-height: 320px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #fef3c7 0%, #fde68a 40%, #fcd34d 100%);
  border-right: 1px solid #f3f4f6;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: flex-basis 0.2s ease;
}

body.web-mode .timeline-island-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.35);
  border: none;
  border-bottom: 1px solid rgba(146, 64, 14, 0.15);
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  cursor: pointer;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

body.web-mode .timeline-island-toggle:hover {
  background: rgba(255, 255, 255, 0.55);
}

body.web-mode .timeline-island-toggle-icon {
  font-size: 14px;
  flex-shrink: 0;
}

body.web-mode .timeline-island-toggle-label {
  flex: 1;
  letter-spacing: 0.05em;
}

body.web-mode .timeline-island-toggle-count {
  background: rgba(146, 64, 14, 0.18);
  color: #92400e;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}

body.web-mode .timeline-island-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 14px;
}

body.web-mode .timeline-island-empty {
  text-align: center;
  font-size: 11px;
  color: #a16207;
  padding: 16px 4px;
  font-style: italic;
}

body.web-mode .timeline-island-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Collapsed state — narrow strip, body hidden, toggle shows just the
   icon vertically. */

body.web-mode .timeline-island--collapsed {
  flex-basis: 36px;
}

body.web-mode .timeline-island--collapsed .timeline-island-toggle {
  flex-direction: column;
  gap: 6px;
  padding: 10px 4px;
  justify-content: flex-start;
  height: 100%;
  border-bottom: none;
}

body.web-mode .timeline-island--collapsed .timeline-island-toggle-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 11px;
  letter-spacing: 0.1em;
  flex: none;
}

body.web-mode .timeline-island--collapsed .timeline-island-toggle-count {
  font-size: 9px;
  padding: 1px 5px;
}

body.web-mode .timeline-island--collapsed .timeline-island-body {
  display: none;
}

body.web-mode .island-task {
  display: block;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(146, 64, 14, 0.15);
  border-radius: 10px;
  color: #1f2937;
  text-decoration: none;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(146, 64, 14, 0.08);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: #9ca3af;
}

body.web-mode .island-task:hover {
  background: #fff;
  border-color: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

body.web-mode .island-task.status-todo { border-left-color: #9ca3af; }
body.web-mode .island-task.status-in_progress { border-left-color: #3b82f6; }
body.web-mode .island-task.status-done { border-left-color: #10b981; opacity: 0.7; }

body.web-mode .island-task-title {
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .island-task-project {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  body.web-mode .timeline-island {
    flex-basis: 150px;
  }
  body.web-mode .timeline-island--collapsed {
    flex-basis: 36px;
  }
}

body.web-mode .timeline-viewport.dragging {
  cursor: grabbing;
}

body.web-mode .timeline-content {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  will-change: transform;
}

/* River — thin horizontal band near the bottom */

body.web-mode .timeline-river {
  position: absolute;
  bottom: 52px;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg,
    rgba(59, 130, 246, 0) 0%,
    rgba(59, 130, 246, 0.4) 8%,
    rgba(59, 130, 246, 0.6) 50%,
    rgba(59, 130, 246, 0.4) 92%,
    rgba(59, 130, 246, 0) 100%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
  pointer-events: none;
}

/* Today vertical line across full viewport height */

body.web-mode .timeline-today-line {
  position: absolute;
  top: 16px;
  bottom: 40px;
  width: 2px;
  background: linear-gradient(180deg, #ef4444 0%, #f87171 60%, rgba(248, 113, 113, 0) 100%);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
  border-radius: 2px;
  pointer-events: none;
}

body.web-mode .timeline-today-label {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
  z-index: 2;
}

/* Date ticks along the bottom */

body.web-mode .timeline-tick {
  position: absolute;
  bottom: 14px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

body.web-mode .timeline-tick-mark {
  width: 1px;
  height: 8px;
  background: rgba(59, 130, 246, 0.5);
  margin: 0 auto 3px;
}

body.web-mode .timeline-tick-label {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
}

/* Task bubbles */

body.web-mode .timeline-task {
  position: absolute;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 12px;
  color: #1f2937;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
  z-index: 1;
  box-sizing: border-box;
}

body.web-mode .timeline-task:hover {
  z-index: 5;
  border-color: #6366f1;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.25);
  transform: translateY(-3px);
}

body.web-mode .timeline-task-tail {
  position: absolute;
  top: 100%;
  width: 2px;
  height: 10px;
  background: rgba(99, 102, 241, 0.35);
  transform: translateX(-50%);
  pointer-events: none;
}

body.web-mode .timeline-task.status-todo {
  border-left: 3px solid #9ca3af;
}

body.web-mode .timeline-task.status-in_progress {
  border-left: 3px solid #3b82f6;
}

body.web-mode .timeline-task.status-done {
  border-left: 3px solid #10b981;
  opacity: 0.7;
}

body.web-mode .timeline-task--overdue {
  border-color: #fca5a5;
  background: #fef2f2;
}

body.web-mode .timeline-task--overdue .timeline-task-dot {
  background: #ef4444;
}

body.web-mode .timeline-task--ghost {
  background: rgba(255, 255, 255, 0.6);
  border-style: dashed;
  border-color: #c7d2fe;
  box-shadow: none;
  opacity: 0.72;
}

body.web-mode .timeline-task--ghost:hover {
  opacity: 1;
  background: #fff;
  border-style: solid;
  border-color: #6366f1;
}

body.web-mode .timeline-task--ghost .timeline-task-dot {
  background: #c7d2fe;
}

body.web-mode .timeline-task-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
  margin-right: 6px;
  vertical-align: middle;
}

body.web-mode .timeline-task-title {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
  vertical-align: middle;
  font-weight: 500;
}

body.web-mode .timeline-task-project {
  display: block;
  font-size: 10px;
  color: #9ca3af;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .timeline-empty {
  padding: 18px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  border-top: 1px solid #f3f4f6;
}

@media (max-width: 768px) {
  body.web-mode .timeline-viewport {
    height: 280px;
  }
}

/* ---------- List toolbar ---------- */

body.web-mode .doc-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

body.web-mode .doc-list-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

body.web-mode .folder-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: 14px;
  color: #6b7280;
  min-width: 0;
}

body.web-mode .folder-crumb-link {
  color: #4f46e5;
  text-decoration: none;
}

body.web-mode .folder-crumb-link:hover {
  text-decoration: underline;
}

body.web-mode .folder-crumb-sep {
  margin: 0 6px;
  color: #d1d5db;
}

body.web-mode .folder-crumb-current {
  color: #374151;
  font-weight: 500;
}

body.web-mode .doc-card--folder {
  border-style: dashed;
}

body.web-mode .doc-card--folder:hover {
  border-color: #6366f1;
  background: #f5f3ff;
}

body.web-mode .file-card--folder {
  border-style: dashed;
}

body.web-mode .file-card--folder:hover {
  border-color: #6366f1;
  background: #f5f3ff;
}

/* ── Drag & Drop ─────────────────────────────────────────── */

body.web-mode .doc-card.dragging,
body.web-mode .file-card.dragging {
  opacity: 0.4;
}

body.web-mode .doc-card--folder.drag-over,
body.web-mode .file-card--folder.drag-over {
  border-color: #6366f1;
  background: #ede9fe;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
  transform: scale(1.02);
  transition: all 0.15s ease;
}

body.web-mode .folder-breadcrumb .folder-crumb-link.drag-over {
  background: #ede9fe;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* ── Project Overview ──────────────────────────────────────── */

body.web-mode .overview-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 24px;
}

body.web-mode .overview-stat-progress {
  flex: 1;
  min-width: 120px;
  max-width: 320px;
}

body.web-mode .overview-stat-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

body.web-mode .overview-stat-pct {
  font-weight: 600;
  color: #111827;
}

body.web-mode .overview-progress-bar {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

body.web-mode .overview-progress-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 4px;
  transition: width 0.3s ease;
}

body.web-mode .overview-stat-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

body.web-mode .overview-pill {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

body.web-mode .overview-pill--todo {
  background: #f3f4f6;
  color: #4b5563;
}

body.web-mode .overview-pill--doing {
  background: #dbeafe;
  color: #1d4ed8;
}

body.web-mode .overview-pill--done {
  background: #dcfce7;
  color: #166534;
}

body.web-mode .overview-pill--overdue {
  background: #fee2e2;
  color: #dc2626;
}

body.web-mode .overview-empty-stats {
  padding: 16px 20px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #9ca3af;
  text-align: center;
  font-size: 14px;
  margin-bottom: 24px;
}

body.web-mode .overview-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

body.web-mode .overview-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

body.web-mode .overview-section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

body.web-mode .overview-desc-content {
  font-size: 14px;
  line-height: 1.6;
  color: #4b5563;
}

body.web-mode .overview-desc-content p:first-child {
  margin-top: 0;
}

body.web-mode .overview-desc-content p:last-child {
  margin-bottom: 0;
}

body.web-mode .overview-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.web-mode .overview-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
}

body.web-mode .overview-field:last-child {
  border-bottom: none;
}

body.web-mode .overview-field-label {
  font-size: 13px;
  color: #6b7280;
}

body.web-mode .overview-field-value {
  font-size: 14px;
  color: #111827;
  font-weight: 500;
}

@media (max-width: 900px) {
  body.web-mode .overview-columns {
    grid-template-columns: 1fr;
  }

  body.web-mode .overview-stats {
    flex-direction: column;
    align-items: stretch;
  }

  body.web-mode .overview-stat-progress {
    max-width: 100%;
  }
}

/* ── Project Shell ─────────────────────────────────────────── */

body.web-mode .project-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.web-mode .project-shell__header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 0 12px;
}

body.web-mode .project-shell__color-bar {
  width: 4px;
  min-height: 40px;
  border-radius: 2px;
  background: var(--project-color, #4f46e5);
  flex-shrink: 0;
}

body.web-mode .project-shell__info {
  min-width: 0;
  flex: 1;
}

body.web-mode .project-shell__name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.web-mode .project-shell__actions {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

body.web-mode .project-shell__action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

body.web-mode .project-shell__action-btn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

body.web-mode .project-shell__desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.web-mode .project-shell__tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e5e7eb;
  padding: 0;
  margin: 0;
  overflow-x: auto;
}

body.web-mode .project-shell__tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

body.web-mode .project-shell__tab:hover {
  color: #374151;
  background: #f9fafb;
}

body.web-mode .project-shell__tab--active {
  color: var(--project-color, #4f46e5);
  border-bottom-color: var(--project-color, #4f46e5);
}

body.web-mode .project-shell__content {
  padding-top: 20px;
  min-height: 200px;
}

/* Breadcrumbs */

body.web-mode .project-shell__breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  font-size: 13px;
  color: #6b7280;
  padding-top: 8px;
}

body.web-mode .project-shell__crumb-link {
  color: #4f46e5;
  text-decoration: none;
}

body.web-mode .project-shell__crumb-link:hover {
  text-decoration: underline;
}

body.web-mode .project-shell__crumb-sep {
  margin: 0 6px;
  color: #d1d5db;
}

body.web-mode .project-shell__crumb-current {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #374151;
  font-weight: 500;
}

body.web-mode .project-shell__crumb-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--project-color, #4f46e5);
}

@media (max-width: 768px) {
  body.web-mode .project-shell__header {
    padding: 16px 0 8px;
  }

  body.web-mode .project-shell__name {
    font-size: 18px;
  }

  body.web-mode .project-shell__tab {
    padding: 8px 12px;
    font-size: 13px;
  }

  body.web-mode .project-shell__breadcrumbs {
    font-size: 12px;
  }
}

/* ── Todo detail (web-native) ────────────────────────────────────────── */

body.web-mode .td-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  body.web-mode .td-page {
    grid-template-columns: 1fr;
  }
}

body.web-mode .td-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

body.web-mode .td-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 20px;
}

@media (max-width: 900px) {
  body.web-mode .td-side {
    position: static;
  }
}

body.web-mode .td-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.web-mode .td-back {
  align-self: flex-start;
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: 6px;
}

body.web-mode .td-back:hover {
  background: #f3f4f6;
  color: #111827;
}

body.web-mode .td-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

body.web-mode .td-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

body.web-mode .td-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

body.web-mode .td-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

body.web-mode .td-select-wrap {
  display: inline-flex;
  position: relative;
}

body.web-mode .td-select {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 26px 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='%23555' d='M2 3l3 4 3-4z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

body.web-mode .td-select.status-todo         { background-color: #f3f4f6; color: #4b5563; }
body.web-mode .td-select.status-in_progress  { background-color: #dbeafe; color: #1d4ed8; }
body.web-mode .td-select.status-done         { background-color: #d1fae5; color: #065f46; }
body.web-mode .td-select.priority-low        { background-color: #f3f4f6; color: #6b7280; }
body.web-mode .td-select.priority-medium     { background-color: #fef3c7; color: #92400e; }
body.web-mode .td-select.priority-high       { background-color: #fee2e2; color: #991b1b; }

body.web-mode .td-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

body.web-mode .td-badge--warn {
  background: #fef3c7;
  color: #92400e;
}

body.web-mode .td-due {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

body.web-mode .td-due--overdue {
  background: #fef2f2;
  border-color: #fecaca;
}

body.web-mode .td-due-icon {
  font-size: 20px;
}

body.web-mode .td-due-text {
  flex: 1;
  min-width: 0;
}

body.web-mode .td-due-date {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

body.web-mode .td-due--overdue .td-due-date {
  color: #b91c1c;
}

body.web-mode .td-due-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

body.web-mode .td-due--overdue .td-due-sub {
  color: #dc2626;
}

body.web-mode .td-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

body.web-mode .td-card-head {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  background: #fafafa;
  border-bottom: 1px solid #e5e7eb;
}

body.web-mode .td-card-head--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.web-mode .td-card-body {
  padding: 16px;
}

body.web-mode .td-count {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 600;
}

body.web-mode .td-progress {
  height: 6px;
  background: #f3f4f6;
}

body.web-mode .td-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  transition: width 0.3s ease;
}

body.web-mode .td-subtask-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.web-mode .td-subtask-list--nested {
  margin-left: 22px;
  margin-top: 4px;
}

body.web-mode .td-subtask-item {
  display: flex;
  flex-direction: column;
}

body.web-mode .td-subtask-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}

body.web-mode .td-subtask-link:hover {
  background: #f3f4f6;
}

body.web-mode .td-subtask-icon {
  font-size: 14px;
}

body.web-mode .td-subtask-title {
  font-size: 14px;
  color: #111827;
}

body.web-mode .td-subtask-title--done {
  color: #9ca3af;
  text-decoration: line-through;
}

body.web-mode .td-activity {
  min-height: 40px;
}

body.web-mode .td-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.web-mode .td-timeline-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

body.web-mode .td-timeline-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 14px;
}

body.web-mode .td-timeline-body {
  flex: 1;
  min-width: 0;
}

body.web-mode .td-timeline-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

body.web-mode .td-timeline-text strong {
  color: #111827;
  font-weight: 600;
}

body.web-mode .td-timeline-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

body.web-mode .td-side-card .td-card-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

body.web-mode .td-meta-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.web-mode .td-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

body.web-mode .td-meta--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

body.web-mode .td-meta-key {
  color: #6b7280;
  flex-shrink: 0;
}

body.web-mode .td-meta-val {
  color: #111827;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.web-mode .td-meta--stack .td-meta-val {
  text-align: left;
}

body.web-mode .td-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  font-size: 11px;
  background: color-mix(in srgb, var(--tc) 15%, transparent);
  color: var(--tc);
  border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent);
}

body.web-mode .td-side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.web-mode .td-crumb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

body.web-mode .td-crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #6b7280;
  min-width: 0;
}

body.web-mode .td-crumb {
  color: #6b7280;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.web-mode .td-crumb:hover {
  background: #f3f4f6;
  color: #111827;
}

body.web-mode .td-crumb-sep {
  color: #d1d5db;
  user-select: none;
}

body.web-mode .subproject-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #6b7280;
}

body.web-mode .subproject-hint-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #4338ca;
  cursor: pointer;
}

body.web-mode .subproject-hint-btn:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
}

/* ── Compact dashboard hero ──────────────────────────────────────── */

body.web-mode .dashboard-hero--compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  flex-wrap: wrap;
}

body.web-mode .dashboard-hero-greeting {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

body.web-mode .dashboard-hero-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

body.web-mode .dashboard-hero-stats .stat-card {
  padding: 6px 10px;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(209, 213, 219, 0.6);
}

body.web-mode .dashboard-hero-stats .stat-card-emoji {
  font-size: 16px;
}

body.web-mode .dashboard-hero-stats .stat-card-value {
  font-size: 17px;
  font-weight: 700;
}

body.web-mode .dashboard-hero-stats .stat-card-label {
  font-size: 11px;
  color: #6b7280;
}

/* ── Inbox sticky-note board ─────────────────────────────────────── */

body.web-mode .sticky-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 8px 0;
}

body.web-mode .sticky-note {
  --sticky-bg: #fef08a;
  background: var(--sticky-bg);
  color: #1f2937;
  text-decoration: none;
  padding: 14px;
  min-height: 120px;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 10px 18px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transform: rotate(-1.2deg);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  font-family: "Kalam", "Noto Sans TC", -apple-system, sans-serif;
  position: relative;
}

body.web-mode .sticky-note:nth-child(3n+1) { transform: rotate(1.4deg); }
body.web-mode .sticky-note:nth-child(3n+2) { transform: rotate(-0.8deg); }
body.web-mode .sticky-note:nth-child(4n+3) { transform: rotate(2deg); }

body.web-mode .sticky-note::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 10px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  filter: blur(0.5px);
}

body.web-mode .sticky-note:hover {
  transform: rotate(0deg) scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18), 0 16px 28px rgba(0, 0, 0, 0.08);
  z-index: 2;
}

body.web-mode .sticky-note-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  color: #111827;
}

body.web-mode .sticky-note-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: rgba(31, 41, 55, 0.75);
}

body.web-mode .sticky-priority {
  font-weight: 600;
}

body.web-mode .sticky-due {
  color: rgba(31, 41, 55, 0.7);
}

body.web-mode .sticky-due-overdue {
  color: #b91c1c;
  font-weight: 600;
}

body.web-mode .inbox-empty {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  background: #fafafa;
  border: 1px dashed #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
}

body.web-mode .dashboard-hero-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #4338ca;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(199, 210, 254, 0.8);
  text-decoration: none;
  white-space: nowrap;
}

body.web-mode .dashboard-hero-link:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
}

/* ── Activity feed page ──────────────────────────────────────────── */

body.web-mode .activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.web-mode .activity-feed-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  background: #fff;
}

body.web-mode .activity-feed-item:hover {
  background: #f9fafb;
}

body.web-mode .activity-feed-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 15px;
}

body.web-mode .activity-feed-body {
  flex: 1;
  min-width: 0;
}

body.web-mode .activity-feed-link {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
}

body.web-mode .activity-feed-link:hover {
  color: #4338ca;
}

body.web-mode .activity-feed-text {
  font-size: 13px;
  color: #4b5563;
  margin-top: 2px;
  line-height: 1.5;
}

body.web-mode .activity-feed-text strong {
  color: #111827;
  font-weight: 600;
}

body.web-mode .activity-feed-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

/* Cap the Markdown content card so very long task bodies scroll
   inside the card instead of pushing the rest of the page (subtasks,
   activity timeline) off-screen. Resizable vertically so users can
   pull it taller when they want more at a glance. */
body.web-mode .td-card-body.markdown-body {
  max-height: min(70vh, 720px);
  overflow-y: auto;
  resize: vertical;
  scrollbar-gutter: stable;
}

/* Give the subtask list the same treatment when it grows long. */
body.web-mode .td-card .td-subtask-list {
  max-height: 420px;
  overflow-y: auto;
}

/* Small visual cue that the area can still scroll down. */
body.web-mode .td-card-body.markdown-body::-webkit-scrollbar {
  width: 8px;
}
body.web-mode .td-card-body.markdown-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
body.web-mode .td-card-body.markdown-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

body.web-mode .members-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
