/* ===== Dashboard View ===== */
.dashboard-scroll {
  flex: 1;
  overflow: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.dash-greeting {
  background: linear-gradient(135deg, var(--accent-light), var(--accent-pink-light));
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.dash-greeting-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.dash-greeting-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

/* 위젯 그리드 — 4열 균등, 남은 높이 채움 */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.dash-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 200ms ease;
}

.dash-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.dash-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.dash-card-icon {
  font-size: 16px;
}

.dash-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dash-card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.dash-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dash-card-action {
  padding: 6px 14px;
  border: 1px solid var(--accent-pink);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--accent-pink);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  align-self: flex-start;
  margin-top: 12px;
  transition: all 150ms ease;
}

.dash-card-action:hover {
  background: var(--accent-pink);
  color: white;
}

/* 배지 (섹션 카운트) */
.dash-card-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-pink);
  background: var(--accent-pink-light);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

.dash-card-badge:empty {
  display: none;
}

/* === 오늘 할일 섹션 === */
.dash-today-todos {
}

.dash-todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dash-todo-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 4px;
  border-radius: var(--radius);
  transition: background 100ms ease;
}

.dash-todo-item:hover {
  background: var(--bg-hover);
}

.dash-todo-item.in-progress {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

.dash-todo-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.dash-todo-check input { display: none; }

.dash-todo-checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}

.dash-todo-check input:checked + .dash-todo-checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.dash-todo-check input:checked + .dash-todo-checkmark::after {
  content: "✓";
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.dash-todo-body {
  flex: 1;
  min-width: 0;
}

.dash-todo-title {
  font-size: 13px;
  color: var(--text-primary);
  display: block;
}

.dash-todo-title.done-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.dash-todo-plan {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.dash-todo-high { border-left: 3px solid var(--danger, #e53e3e); padding-left: 8px; }

/* === 인박스 리스트 섹션 === */
.dash-inbox {
}

.dash-inbox-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dash-inbox-item {
  border-radius: var(--radius);
  transition: all 200ms ease;
}

.dash-inbox-item:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.dash-inbox-link {
  display: block;
  padding: 8px 4px;
  text-decoration: none;
  color: inherit;
  outline: none;
}

.dash-inbox-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-inbox-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.dash-inbox-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dash-inbox-footer {
  flex-shrink: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.dash-inbox-more {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: block;
  padding: 4px;
}

/* === 활성 계획 (진행률 포함) === */
.dash-plans {
}

/* 계획 리스트 */
.dash-plan-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dash-plan-item {
  font-size: 13px;
  color: var(--text-primary);
  padding: 6px 0;
}

.dash-plan-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-plan-top::before {
  content: "\2022";
  color: var(--accent);
  font-weight: 700;
}

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

.dash-plan-context {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.dash-plan-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-left: 14px;
}

.dash-plan-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.dash-plan-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
}

.dash-plan-progress-text {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* D-day 뱃지 */
.dash-plan-dday {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.dash-plan-dday-urgent {
  color: #fff;
  background: var(--danger, #e53e3e);
}

/* Next Action */
.dash-plan-next {
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
  padding-left: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Empty State === */
.dash-empty-state {
  text-align: center;
  padding: 16px 8px;
}

.dash-empty-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.dash-empty-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dash-empty-action {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.dash-recent {
}

/* 최근 활동 필터 */
.dash-recent-filters {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dash-recent-filters::-webkit-scrollbar { display: none; }

/* cursor/transition from .ui-btn base */
.dash-filter-btn {
  background: var(--bg-secondary, #f0f0f0);
  border: none;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-secondary, #666);
  white-space: nowrap;
}
.dash-filter-btn.active {
  background: var(--accent, #4a9eff);
  color: #fff;
}

/* 최근 활동 리스트 */
.dash-recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dash-recent-item {
  display: flex;
  align-items: center;
  font-size: 13px;
  gap: 8px;
  padding: 4px 0;
}

.dash-recent-clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  transition: background 0.15s;
}
.dash-recent-clickable:active {
  background: var(--bg-secondary, #f0f0f0);
}

.dash-recent-icon {
  flex-shrink: 0;
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.dash-recent-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dash-recent-title {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-recent-tags {
  font-size: 11px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.dash-tag-chip {
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.dash-recent-tag-highlight {
  background: var(--accent-light);
}

.dash-recent-tag-highlight .dash-recent-title {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11px;
}

.dash-recent-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* 볼트 통계: 최상단 요약 바 (그리드 밖, 데스크탑 sticky) */
.dash-stats {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .dash-stats {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
}

.dash-stats .dash-card-value {
  font-size: 24px;
}

.dash-stats .dash-card-label {
  margin-top: 0;
}

/* 타입 분포 */
.dash-type-breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
}

/* === 리스트 스크롤바 스타일 (WebKit) === */
.dash-todo-list::-webkit-scrollbar,
.dash-inbox-list::-webkit-scrollbar,
.dash-plan-list::-webkit-scrollbar,
.dash-recent-list::-webkit-scrollbar {
  width: 4px;
}

.dash-todo-list::-webkit-scrollbar-thumb,
.dash-inbox-list::-webkit-scrollbar-thumb,
.dash-plan-list::-webkit-scrollbar-thumb,
.dash-recent-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* === Skeleton Loading === */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.dash-skeleton-line {
  height: 12px;
  background: var(--border);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.dash-skeleton-line + .dash-skeleton-line {
  margin-top: 10px;
}

.dash-skeleton-line.w-75 { width: 75%; }
.dash-skeleton-line.w-60 { width: 60%; }
.dash-skeleton-line.w-50 { width: 50%; }
.dash-skeleton-line.w-40 { width: 40%; }
.dash-skeleton-line.w-90 { width: 90%; }

/* === Collapsible Section === */
/* 데스크탑: 토글 버튼 숨김, 콘텐츠 항상 표시 */
.dash-collapse-toggle {
  display: none;
}

.dash-collapsible {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 모바일 인박스 배지: 데스크탑 숨김 */
.dash-inbox-badge-mobile {
  display: none !important;
}

/* Dashboard mobile */
@media (max-width: 767px) {
  .dashboard-scroll {
    padding: 14px;
    overflow-y: auto;
  }

  .dash-greeting {
    padding: 16px;
  }

  .dash-greeting-text {
    font-size: 16px;
  }

  /* 단일 컬럼 전환 */
  .dash-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dash-card {
    padding: 14px;
  }

  .dash-card-value {
    font-size: 28px;
  }

  /* 볼트 통계 모바일: 세로 레이아웃 복원 */
  .dash-stats {
    flex-direction: column;
    align-items: flex-start;
  }

  .dash-stats .dash-card-value {
    font-size: 28px;
  }

  .dash-type-breakdown {
    margin-left: 0;
    margin-top: 8px;
  }

  /* 모바일 순서: 볼트(HTML 순서 0) > 할일 > 인박스 > 나머지 */
  .dash-today-todos {
    order: -2;
  }

  .dash-inbox {
    order: -1;
  }

  .dash-inbox .dash-inbox-list,
  .dash-inbox .dash-empty-state {
    display: none;
  }

  .dash-inbox-badge-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 2px;
    cursor: pointer;
    min-height: 44px;
  }

  .dash-inbox-badge-mobile .badge-count {
    background: var(--accent-pink);
    color: white;
    font-size: 13px;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
  }

  .dash-inbox-badge-mobile .badge-label {
    font-size: 13px;
    color: var(--text-secondary);
  }

  .dash-inbox-badge-mobile .badge-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 16px;
  }

  /* 인박스 모바일 배지 표시 */
  .dash-inbox-badge-mobile {
    display: flex !important;
  }

  /* 접힘 토글이 있는 카드: 원래 헤더 숨김 */
  .dash-plans > .dash-card-header,
  .dash-recent > .dash-card-header,
  .dash-stats > .dash-card-header {
    display: none;
  }

  /* 접힘 가능 섹션 (최근 활동, 활성 계획, 볼트 통계) */
  .dash-collapse-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-family);
    width: 100%;
    min-height: 44px;
  }

  .dash-collapse-toggle .collapse-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 200ms ease;
    display: inline-block;
  }

  .dash-collapse-toggle.open .collapse-arrow {
    transform: rotate(90deg);
  }

  .dash-collapsible {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 300ms ease, opacity 200ms ease;
  }

  .dash-collapsible.open {
    max-height: 2000px;
    opacity: 1;
  }

  /* 터치 영역 44px 보장 */
  .dash-todo-item {
    min-height: 44px;
    padding: 10px 4px;
  }

  .dash-todo-check {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .dash-inbox-item {
    min-height: 44px;
  }

  .dash-inbox-link {
    padding: 10px 4px;
  }

  .dash-filter-btn {
    min-height: 36px;
    padding: 6px 12px;
  }

  .dash-recent-item {
    min-height: 44px;
    padding: 8px 0;
  }

  .dash-card-action {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .dash-empty-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* 카드 간 여백 조정 */
  .dash-card + .dash-card {
    margin-top: 2px;
  }
}
