:root {
  --paper: #2a2a33;
  --ink: #e0e0e0;
  --muted: #888;
  --accent: #3a86ff;
  --danger: #ff6b6b;
  --sidebar-bg: #212129;
  --app-bg: #1e1f22;

  --font-size-base: 14px;
  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  background: var(--app-bg);
  color: var(--ink);
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
}

/* --- 사이드바 --- */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  padding: 16px;
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.profile-display {
  padding: 8px 0;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color: 0.2s;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.2);
  transition: background-color: 0.2s;
}

.profile-item label {
  font-weight: bold;
  color: var(--muted);
}

.inline-profile-input {
  flex: 1;
  margin-left: 35px;
  padding: 4px 8px;
  border-radius: 4px;
  font: 14px var(--font-family-base);
  text-align: right;
  box-sizing: border-box;
  color: var(--ink);
  width: 55%;
  border: 1px solid transparent;
  background-color: transparent;
}

.inline-profile-input:focus {
  outline: none;
}

.inline-profile-input.locked {
  cursor: pointer;
}

.inline-profile-input.locked:hover {
  background-color: transparent;
}

.inline-profile-input.unverified {
  color: var(--danger) !important;
}

.inline-profile-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* 사이드바 헤더 & 수신함 버튼 */
.sidebar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 16px 0;
  border-bottom: 1px solid #444;
  padding-bottom: 8px;
}

.sidebar h3 {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
  font-size: 18px;
}

.sidebar-inbox-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  position: relative;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-inbox-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

.sidebar-inbox-btn svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.sidebar-inbox-btn .inbox-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--sidebar-bg);
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* [신규] 인박스 알림 있을 때 흔들림 애니메이션 */
@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
  20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

.sidebar-inbox-btn.has-notification svg {
  animation: shake 1.0s ease-in-out infinite;
  animation-iteration-count: 1; /* 3번만 반복 */
}

.sidebar-inbox-btn.has-notification {
  color: #ffd700; /* 금색으로 강조 */
}


/* 워크스페이스 리스트 */
#workspace-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* [신규] 워크스페이스 리스트 스크롤바 스타일 (Paper와 통일) */
#workspace-list::-webkit-scrollbar {
  width: 8px;
}

#workspace-list::-webkit-scrollbar-track {
  background: #212129;
  /* 사이드바 배경색에 맞춤 */
}

#workspace-list::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

#workspace-list::-webkit-scrollbar-thumb:hover {
  background: #777;
}

#workspace-list .team-name {
  font-weight: bold;
  font-size: 14px;
  padding: 8px 0;
  cursor: pointer;
}

#workspace-list .team-members {
  list-style: none;
  padding-left: 16px;
}

#workspace-list .member-item {
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color: 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

#workspace-list .member-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

#workspace-list .member-item.active {
  background-color: var(--accent);
  color: #fff;
  font-weight: bold;
}

#workspace-list .member-item.my-item:not(.active) {
  color: #FFC107;
  font-weight: bold;
}

/* 빠른 전환 버튼 */
.quick-switch-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 1px 1px;
  border-radius: 1px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 1px;
  opacity: 0;
  visibility: hidden;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* active 상태일 때만 버튼 표시 */
.member-item.active .quick-switch-btn {
  opacity: 1;
  visibility: visible;
}

.quick-switch-btn:hover {
  color: #FFF;
  transform: scale(1.1);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.9);
}

.remove-member-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
  padding: 0 4px;
  border-radius: 50%;
  display: none;
}

.member-item:hover .remove-member-btn {
  display: inline;
}

.remove-member-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--danger);
}

.member-item.active .remove-member-btn {
  display: none;
}

/* 하단 전송 버튼 스타일 */
.sidebar-action-group {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.sidebar-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #555;
  color: var(--muted);
  width: 100%;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
  font-weight: bold;
  transition: background-color: 0.2s, color: 0.2s;
}

.sidebar-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.sidebar-action-btn:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
  border-color: #444;
}

#export-to-server-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: auto;
  padding: 12px 8px;
}

.sync-time-text {
  font-size: 11px;
  font-weight: normal;
  color: #888;
  margin-top: 2px;
}

#export-to-server-btn:hover .sync-time-text {
  color: #bbb;
}

/* --- 메인 콘텐츠 --- */
.main-content {
  flex: 1;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 16px;
}

#main-title {
  flex: 1;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  padding: 1px;
  border-radius: 4px;
  outline: none;
  transition: background-color: 0.2s;
}

#main-title:hover,
#main-title:focus {
  background-color: rgba(255, 255, 255, 0.05);
}

#main-title:empty:before {
  content: '제목을 입력하세요';
  color: var(--muted);
  cursor: text;
}

.header-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 뷰 옵션 툴바 */
#view-options-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 16px 4px;
  gap: 216px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.search-wrapper {
  position: relative;
  width: 200px;
}

.search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #444;
  border-radius: 16px;
  padding: 6px 12px 6px 28px;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

#search-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
}

.priority-filter-group {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 2px;
  border: 1px solid #444;
}

.filter-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
}

.filter-btn:hover {
  color: var(--ink);
}

.filter-btn.active {
  background-color: var(--accent);
  color: #fff;
  font-weight: bold;
}

.filter-count {
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.8;
  font-weight: normal;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.toggle-text {
  font-size: 13px;
  color: var(--muted);
  font-weight: bold;
}

.toggle-label:hover .toggle-text {
  color: var(--ink);
}

.search-mode-badge {
  background-color: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  margin-left: 8px;
}

/* --- 페이퍼 영역 --- */
.paper {
  background: var(--paper);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.main-content.read-only .paper {
  opacity: 0.7;
}

.main-content.read-only .bullet,
.main-content.read-only .task-content-wrapper {
  pointer-events: none;
}

.main-content.read-only .foot {
  opacity: 0.7;
  pointer-events: none;
}

.main-content.read-only #main-title {
  pointer-events: none;
}

/* [신규] 전역 스크롤바 스타일 (모든 곳 통일) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #2c2c34;
  /* 기본 트랙 색상 (Paper, 모달 등) */
}

::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* 사이드바 내부는 배경색에 맞춰 트랙 색상 조정 */
#workspace-list::-webkit-scrollbar-track {
  background: #212129;
}

.col {
  background: transparent;
  position: relative;
  padding-left: 12px;
  border-left: 2px dashed rgba(255, 255, 255, 0.1);
  cursor: default;
  /* [수정] 다시 일반 커서(화살표)로 변경 */
}

.col:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0 6px, transparent 6px 12px);
}

.col-header {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
  cursor: default;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- 할 일 아이템 --- */
li.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 2px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 28px;
  transition: margin-left 0.2s ease-out, background-color 0.2s ease-out;
}

.task-text {
  color: var(--ink);
  padding: 1px 0;
  transition: color 0.2s, opacity 0.2s;
  min-width: 0;
  word-break: break-all;
  position: relative;
}

.task-text:focus {
  outline: none;
}

/* [수정] 우선순위별 색상 강화 */
li.task.priority-important .task-text,
li.task.priority-important.editing .task-text {
  color: #FFC107 !important;
  font-weight: bold;
}

li.task.priority-urgent .task-text,
li.task.priority-urgent.editing .task-text {
  color: #ff6b6b !important;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 107, 107, 0.2);
}

li.task.done .task-text,
li.task.done.editing .task-text {
  text-decoration: line-through;
  color: var(--muted) !important;
  opacity: 0.7;
  font-weight: normal !important;
  text-shadow: none !important;
}

/* 작업중 상태 시각적 표시 */
li.task.in-progress {
  border-left: 5px solid #FFA500;
  background: rgba(255, 165, 0, 0.12);
  padding-left: 6px;
  margin-left: -3px;
}

li.task.in-progress .task-text {
  font-weight: 600;
}

/* 작업중 + 완료된 경우 (완료가 우선) */
li.task.in-progress.done {
  border-left-color: #888;
  background: transparent;
}

li.task.in-progress.done .task-text {
  font-weight: normal !important;
}


/* Bullet */
/* Bullet - Sophisticated Redesign */
.bullet {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  /* 부드러운 라운드 */
  border: 2px solid #6c757d;
  /* 차분한 회색 테두리 */
  flex: 0 0 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  /* 텍스트와 높이 중심을 맞추기 위해 margin-top 조정 (폰트/줄간격 고려) */
  margin-top: 2px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background-color: transparent;
}

.bullet:hover {
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.05);
  transform: scale(1.05);
}

li.task.done .bullet {
  background-color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  /* animation: popIn ... 삭제 (전체 리렌더링 시 깜빡임 방지) */
}

/* CSS로 그린 깔끔한 체크마크 */
li.task.done .bullet::before {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}

@keyframes popIn {
  0% {
    transform: scale(0.8);
  }

  100% {
    transform: scale(1);
  }
}

/* 날짜 아이템 (구분선) */
li.task.date-item .task-text {
  color: var(--accent);
  font-style: italic;
}

li.task.date-item .bullet {
  visibility: hidden;
}

.line-number {
  width: 28px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  padding-right: 8px;
  user-select: none;
  line-height: 24px;
}

/* 뱃지 스타일 */
.task-text.has-dday::before {
  content: attr(data-dday-badge);
  display: inline-block;
  vertical-align: top;
  margin-right: 6px;
  position: relative;
  top: 1px;
  font-weight: bold;
  font-size: 13px;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: #4a4a5a;
  color: #c0c0c0;
}

li.task.done .task-text.has-dday::before {
  background-color: #3a3a4a;
  color: #888;
  text-decoration: line-through;
}

.task-text.dday-today::before {
  background-color: var(--danger);
  color: #fff;
}

.task-text.dday-overdue::before {
  background-color: #222;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.task-text.has-progress::after {
  content: attr(data-progress-badge);
  display: inline-block;
  vertical-align: top;
  margin-left: 6px;
  position: relative;
  top: 1px;
  font-weight: bold;
  font-size: 13px;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: #5a6a7a;
  color: #e0e0e0;
}

li.task.done .task-text.has-progress::after {
  display: none;
}

.task-from-badge {
  display: inline-block;
  background-color: #6f42c1;
  color: white;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  font-weight: normal;
  line-height: 1.2;
}

.task-badge-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  background-color: rgba(76, 155, 180, 0.85);
  color: #fff;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

.main-content.read-only li.task.done:hover .task-badge-overlay {
  opacity: 1;
}

li.task.editing:not(.existing-task) .bullet {
  visibility: hidden;
}

li.task.editing .task-text {
  width: 100%;
  box-sizing: border-box;
}

li.task.editing .task-content-wrapper {
  background-color: rgba(58, 134, 255, 0.1);
  border: 1px solid var(--accent);
}

.task-content-wrapper {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 1px 1px;
}

/* --- Global Task Toolbar (통일된 디자인 & 강력한 색상) --- */
#global-task-toolbar {
  position: absolute;
  display: none;
  align-items: center;
  gap: 2px;

  /* ▼▼▼ 이 부분을 수정하세요 ▼▼▼ */
  background-color: #424250;
  /* 추천: 기존보다 밝은 톤 */
  /* background-color: #333;  <-- 또는 무난한 진회색 */
  /* ▲▲▲ -------------------- ▲▲▲ */

  border: 1px solid #666;
  /* 테두리도 살짝 밝게 하면 더 잘 보입니다 */
  border-radius: 8px;
  padding: 4px 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  /* 그림자 진하게 */
  z-index: 100;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 6px;
  margin-right: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.toolbar-group:last-child {
  border-right: none;
  margin-right: 0;
  padding-right: 0;
}

#global-task-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  height: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  padding: 0 6px;
  transition: all 0.2s;
}

#global-task-toolbar button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

#global-task-toolbar button svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* 버튼 스타일 */
#global-task-toolbar .priority-btn[data-priority="1"] {
  color: #FFC107;
}

#global-task-toolbar .priority-btn[data-priority="2"] {
  color: #ff6b6b;
}

#global-task-toolbar .priority-btn.selected {
  transform: scale(1.1);
  color: #fff !important;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

#global-task-toolbar .priority-btn[data-priority="0"].selected {
  background-color: #666;
  border-color: #666;
}

#global-task-toolbar .priority-btn[data-priority="1"].selected {
  background-color: #FFC107;
  border-color: #FFC107;
  color: #222 !important;
}

#global-task-toolbar .priority-btn[data-priority="2"].selected {
  background-color: #ff6b6b;
  border-color: #ff6b6b;
}

/* 작업중 버튼 스타일 */
#global-task-toolbar .in-progress-btn {
  font-size: 13px;
  padding: 0 8px;
}

#global-task-toolbar .in-progress-btn:hover {
  background: rgba(255, 165, 0, 0.2);
  border-color: #FFA500;
}

#global-task-toolbar .in-progress-btn.selected {
  background: rgba(255, 165, 0, 0.3);
  border-color: #FFA500;
  box-shadow: 0 0 8px rgba(255, 165, 0, 0.4);
  transform: scale(1.1);
}

#global-task-toolbar .progress-btn {
  font-family: 'Nanum Gothic Coding', monospace;
  font-size: 11px;
}

#global-task-toolbar .progress-btn.selected {
  background-color: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
}

#global-task-toolbar .dday-btn.selected {
  color: var(--danger);
  background-color: rgba(255, 107, 107, 0.15);
}

#global-task-toolbar .handover-btn:hover {
  color: #4cd137;
}

.date-picker-wrapper,
.dday-picker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.transparent-date-input,
.transparent-dday-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  cursor: pointer;
  z-index: 10;
}

/* --- 첨부파일 --- */
.attachment-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  max-width: 100%;
  border-radius: 4px;
  background-color: rgba(58, 134, 255, 0.1);
  border: 1px solid rgba(58, 134, 255, 0.3);
}

.attachment-link {
  margin-top: 0;
  background-color: transparent;
  border: none;
  flex-grow: 1;
  min-width: 0;
  font-size: 11px;
  color: rgba(58, 134, 255, 0.65);
}

.attachment-link:hover {
  text-decoration: underline;
  color: rgba(58, 134, 255, 1);
}

.attachment-delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  flex-shrink: 0;
  display: inline-block;
  transition: all 0.2s;
  border-radius: 0 4px 4px 0;
  opacity: 0.6;
}

.attachment-delete-btn:hover {
  opacity: 1;
  color: var(--danger);
  background-color: rgba(255, 107, 107, 0.2);
}

.main-content.read-only .attachment-delete-btn {
  display: none !important;
}

.main-content.read-only .attachment-link {
  pointer-events: auto;
  cursor: pointer;
}

/* --- 푸터 --- */
.foot {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #444;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-nav button,
.page-nav-status {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}

.page-nav-status {
  cursor: default;
}

.page-nav button:disabled {
  color: #555;
  cursor: not-allowed;
}

.foot-menu a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  margin-left: 12px;
}

.foot-menu a:hover {
  text-decoration: underline;
}

.foot-menu a.danger {
  color: var(--danger);
}

.foot-menu .separator {
  color: #555;
  margin-left: 12px;
}

.hidden {
  display: none !important;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 12px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color: 0.2s, color: 0.2s;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

#settings-btn {
  margin-left: 0px;
}

#last-updated-display {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

/* [수정] 완료 날짜 표시 (화면 기준 고정 위치) */
#completion-date-display {
  position: absolute;
  /* absolute -> fixed로 변경 */
  z-index: 9999;
  background-color: #3c3c4c;
  color: #e0e0e0;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 4px;
  border: 1px solid #555;
  white-space: nowrap;
  display: none;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* --- 모달 공통 --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 100;
}

/* [수정] 모달 레이아웃 수정 (내용 잘림 방지) */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--sidebar-bg);
  border: 1px solid #555;
  border-radius: 8px;
  width: 400px;
  /* 기본 모달 너비 */
  max-width: 90%;
  max-height: 90vh;
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  z-index: 101;
  display: flex;
  flex-direction: column;
}

/* [신규] 프로필 모달은 더 넓게 설정 (2단 그리드용) */
#profile-modal {
  width: 700px;
}

.settings-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  flex: 1;
}

/* [신규] 프로필 모달 내부 그리드 레이아웃 */
#profile-modal .settings-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-content: start;
  /* 위쪽 정렬 */
}

.settings-card {
  background-color: #2a2a33;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 0;
  /* 그리드 gap 사용하므로 마진 제거 */
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

/* [신규] 전체 너비 카드 (하단 배치용) */
.settings-card.full-width {
  grid-column: span 2;
}

/* [신규] 높이 꽉 채우기 (오른쪽 목록용) */
.settings-card.full-height {
  grid-row: span 2;
  height: auto;
}

.settings-card-header {
  font-size: 14px;
  font-weight: bold;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-card-header .sub-text {
  font-size: 11px;
  color: var(--muted);
  font-weight: normal;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

.danger-zone {
  border: 1px solid rgba(255, 107, 107, 0.3);
  background-color: rgba(255, 107, 107, 0.05);
}

.danger-zone .settings-card-header {
  color: #ff6b6b;
}

/* 기존 스타일 오버라이드 및 조정 */
#profile-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  /* 높이 확장 (300px -> 400px) */
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
  /* 카드 내에서 남은 공간 차지 */
}

.modal-header,
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #444;
  background-color: #1e1e1e;
  border-radius: 8px 8px 0 0;
}

.modal-header h2,
.settings-header h2 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.modal-close-btn,
#settings-close-btn,
#profile-close-btn,
#ai-close-btn,
#handover-close-btn,
#inbox-close-btn {
  font-size: 20px;
  font-weight: bold;
  margin-left: auto;
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

/* [수정] 모달 컨텐츠 스크롤 처리 */
.settings-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  flex: 1;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.setting-item label {
  font-weight: 500;
  flex-shrink: 0;
}

.setting-item input,
.setting-item select {
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  color: var(--ink);
  padding: 8px;
  font-size: 14px;
}

/* [신규] 체크박스 크기 확대 */
.setting-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  padding: 0;
}

.setting-item input[type="number"] {
  width: 80px;
}

.setting-item select {
  flex: 1;
}

.setting-item-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item-col input,
.setting-item-col textarea,
.setting-item-col select {
  width: 100%;
  box-sizing: border-box;
}

.setting-divider {
  border: none;
  border-top: 1px solid #444;
  margin: 0;
}

.modal-copyright {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  padding-top: 20px;
  border-top: 1px solid #444;
}

/* 모달별 설정 */
#settings-overlay,
#profile-overlay,
#ai-overlay,
#handover-overlay,
#inbox-overlay {
  z-index: 110;
}

#settings-modal,
#profile-modal,
#ai-modal,
#handover-modal,
#inbox-modal {
  z-index: 111;
}

#ai-modal {
  width: 500px;
}

#ai-json-input {
  width: 100%;
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  color: var(--ink);
  padding: 10px;
  font-size: 14px;
  font-family: 'Nanum Gothic Coding', monospace;
  box-sizing: border-box;
  resize: vertical;
}

#ai-confirm-btn {
  width: 100%;
  margin-top: 8px;
  background-color: var(--accent);
  border: none;
  color: #fff;
}

#ai-confirm-btn:hover {
  opacity: 0.9;
}

.settings-card {
  background-color: #2a2a33;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-card-header {
  font-size: 14px;
  font-weight: bold;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-card-header .sub-text {
  font-size: 11px;
  color: var(--muted);
  font-weight: normal;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

.danger-zone {
  border: 1px solid rgba(255, 107, 107, 0.3);
  background-color: rgba(255, 107, 107, 0.05);
}

.danger-zone .settings-card-header {
  color: #ff6b6b;
}

/* 기존 스타일 오버라이드 및 조정 */
#profile-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
  /* 스크롤바 공간 확보 */
}

/* [신규] 저장된 목록 스크롤바 스타일 (Paper와 통일) */
#profile-list-container::-webkit-scrollbar {
  width: 8px;
}

#profile-list-container::-webkit-scrollbar-track {
  background: #2c2c34;
}

#profile-list-container::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

#profile-list-container::-webkit-scrollbar-thumb:hover {
  background: #777;
}

.profile-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.2);
}

.profile-list-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.profile-alias {
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-key-masked {
  font-family: 'Nanum Gothic Coding', monospace;
  font-size: 12px;
  color: var(--muted);
}

.delete-profile-btn {
  background-color: var(--danger);
  color: #fff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
}

/* 통계, 가이드, 뷰어 모달 */
#statistics-overlay,
#guide-overlay,
#md-viewer-overlay {
  z-index: 119;
}

#statistics-wrapper-modal,
#guide-modal,
#md-viewer-modal {
  width: 80%;
  max-width: 900px;
  height: 85vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 120;
  overflow: hidden;
}

#statistics-iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex-grow: 1;
}

.guide-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: #1e1e1e;
  border-radius: 0 0 8px 8px;
  line-height: 1.6;
}

.guide-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.guide-content th,
.guide-content td {
  border: 1px solid #555;
  padding: 8px 12px;
  text-align: left;
}

.guide-content th {
  background-color: #2c2c34;
  font-weight: bold;
}

#md-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  width: 100%;
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
  transition: all 0.2s;
}

#md-title-input:not([readonly]) {
  background: #333;
  border-color: #555;
}

#md-title-input:focus {
  border-color: var(--accent);
}

.md-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 16px;
}

.md-actions button {
  background-color: #333;
  border: 1px solid #555;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  transition: all 0.2s;
}

.md-actions button:hover {
  background-color: #444;
}

#md-save-btn {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#md-save-btn:hover {
  opacity: 0.9;
}

#md-cancel-btn {
  color: var(--danger);
  border-color: var(--danger);
  background-color: transparent;
}

#md-cancel-btn:hover {
  background-color: rgba(255, 107, 107, 0.1);
}

.md-body-container {
  flex-grow: 1;
  overflow: hidden;
  background-color: #1e1e1e;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
}

#md-viewer-content,
#md-editor-textarea {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

#md-viewer-content pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Nanum Gothic Coding', monospace;
  font-size: 14px;
  color: var(--ink);
}

#md-editor-textarea {
  background-color: #181818;
  color: #e0e0e0;
  border: none;
  resize: none;
  font-family: 'Nanum Gothic Coding', monospace;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  width: 100%;
  height: 100%;
}

.handover-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.handover-form textarea {
  background: #333;
  border: 1px solid #555;
  color: var(--ink);
  padding: 8px;
  border-radius: 4px;
  resize: vertical;
  font-family: var(--font-family-base);
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid #444;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px;
  cursor: pointer;
  font-weight: bold;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

#inbox-list,
#history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

/* [신규] 인박스 모달 크기 확대 */
#inbox-modal {
  width: 700px;
  max-width: 95%;
}

.inbox-item {
  background-color: #2a2a33;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.inbox-from {
  font-weight: bold;
  color: var(--accent);
}

.inbox-content {
  font-size: 14px;
  font-weight: bold;
  color: var(--ink);
}

.inbox-message {
  background-color: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 4px;
  font-size: 13px;
  color: #ccc;
  white-space: pre-wrap;
}

.inbox-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.inbox-accept-btn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
}

.inbox-accept-btn:hover {
  opacity: 0.9;
}

#task-message-viewer {
  position: fixed;
  /* absolute -> fixed로 변경 (스크롤 꼬임 방지) */
  background-color: #2d2d3a;
  border: 1px solid #6f42c1;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 9999;
  /* 툴바보다 더 위로 */
  max-width: 300px;
  font-size: 12px;
  color: #e0e0e0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  display: none;
  pointer-events: none;
  /* 마우스가 뷰어에 걸리지 않게 */
}

#task-message-viewer strong {
  color: #a57aff;
  display: block;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
}

.sortable-ghost {
  opacity: 0.4;
  background-color: rgba(58, 134, 255, 0.3);
}

/* --- [복구] 토스트 팝업 (이전 디자인) --- */
#toast-popup {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  /* 단순 검정 반투명 */
  color: #fff;
  padding: 12px 24px;
  border-radius: 4px;
  /* 둥근 모서리 */
  font-size: 14px;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s, bottom 0.3s;
}

#toast-popup.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
}

#toast-popup.success {
  background-color: rgba(0, 0, 0, 0.8);
}

/* 색상 안 씀, 심플하게 */
#toast-popup.error {
  background-color: rgba(200, 50, 50, 0.9);
}

/* 에러만 살짝 붉게 */

.toast-btn {
  background-color: #f0f0f0;
  color: #333;
  border: none;
  padding: 5px 10px;
  margin-left: 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.toast-btn:hover {
  background-color: #ddd;
}

/* ... (기존 CSS 코드) ... */

/* [신규] 게스트 모드 스타일 */
body.guest-mode .sidebar-action-group,

body.guest-mode #add-tasks-ai-btn-sidebar,
body.guest-mode #inbox-btn,

body.guest-mode .foot-menu,
/* 하단 메뉴(삭제 등) 숨김 */
body.guest-mode #main-title {
  pointer-events: none;
  /* 클릭 불가 */
  opacity: 0.6;
  /* 비활성화된 느낌 추가 */
}




body.guest-mode .sidebar-action-group,

body.guest-mode #add-tasks-ai-btn-sidebar,
body.guest-mode #inbox-btn {
  display: none !important;
  /* 버튼 숨김 */
}

/* 게스트 모드임을 알리는 뱃지 스타일 (선택 사항) */
body.guest-mode .sidebar:before {
  content: 'GUEST VIEWER';
  display: block;
  text-align: center;
  background-color: #ff9800;
  color: #000;
  font-weight: bold;
  font-size: 12px;
  padding: 4px;
  margin-bottom: 10px;
  border-radius: 4px;
}

/* 게스트 모드에서 페이퍼 영역 상호작용 차단 */
body.guest-mode .paper {
  pointer-events: none;
}

/* 단, 스크롤은 가능해야 함 -> paper 자체 pointer-events는 auto로 두고 task click만 막거나
   JS에서 click 리스너를 막는 게 더 확실함. (JS에서 처리됨) 
   CSS로는 '커서'만 기본으로 변경 */
body.guest-mode .paper .task {
  cursor: default;
}

body.guest-mode .paper .task:hover {
  background-color: transparent;
  /* 호버 효과 제거 */
}

/* 첨부파일 링크는 클릭 가능해야 함 (JS에서 read-only 클래스 활용) */
body.guest-mode .attachment-link {
  pointer-events: auto;
  cursor: pointer;
}

body.guest-mode .attachment-delete-btn {
  display: none;
}

/* [신규] 할 일 텍스트 2줄 생략 스타일 */
.task-text {
  flex: 1;
  outline: none;
  cursor: pointer;
  /* [수정] 텍스트 커서 -> 포인터(손가락)로 변경 */
  min-width: 0;
  word-break: break-all;
  /* [수정] 긴 영문(GUID 등) 강제 줄바꿈 */
  white-space: pre-wrap;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* [신규] 수정 모드(포커스)일 때는 텍스트 커서로 변경 */
.task-text:focus,
li.task.editing .task-text {
  cursor: text;
}

.task-text:focus,
.task-text.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.task.done .task-text {
  color: #888;
  text-decoration: line-through;
}

/* [신규] 읽기 전용 모드에서도 클릭 가능하도록 커서 변경 */
.read-only .task-text,
body.guest-mode .task-text {
  cursor: pointer;
}

/* [신규] 이미지 뷰어 관련 스타일 */
#image-viewer-modal img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

#image-viewer-close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 30px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}

#image-viewer-close-btn:hover {
  color: var(--danger);
  transform: scale(1.1);
}

/* 첨부파일 링크 스타일 */
.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  background: rgba(58, 134, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  transition: all 0.2s;
}

.attachment-link:hover {
  background: rgba(58, 134, 255, 0.2);
  text-decoration: underline;
}

/* 이미지 뷰어 아이콘 버튼 */
.icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 4px 0;
  z-index: 10000;
  min-width: 200px;
  display: none;
}

.context-menu.visible {
  display: block;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  transition: background-color 0.15s;
  user-select: none;
}

.context-menu-item:hover:not(.disabled) {
  background-color: rgba(255, 255, 255, 0.1);
}

.context-menu-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.context-menu-item .icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.context-menu-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* Discord Icon in Gutter */
.discord-icon {
  position: absolute;
  left: 14px; /* Align with right-aligned line number */
  top: 24px; /* Right below the line number */
  font-size: 16px;
  cursor: default;
  pointer-events: none; /* Click-through as requested */
  opacity: 0.8;
  z-index: 1;
}

li.task:hover .discord-icon {
  opacity: 1;
}