:root {
  --text-primary: #1b1b19;
  --text-secondary: #5f5e5a;
  --text-muted: #8a8983;
  --border: #e5e3dc;
  --surface-1: #f7f6f2;
  --surface-2: #ffffff;
  --radius: 10px;
  --danger-text: #a23c3c;
  --danger-border: #f0c9c9;
  --danger-bg-hover: #fbeaea;
}

/* ---- 공용 버튼 시스템 ----
   버튼 종류가 화면마다 제각각이던 걸 하나로 통일: 굵기/간격/모서리/hover·focus·disabled
   상태를 여기서만 관리하고, 각 버튼은 역할에 맞는 클래스(.btn-primary/.btn-secondary/
   .btn-danger/.btn-ghost/.btn-icon)만 붙여 쓴다. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--brand-primary, #0f6e56);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn .material-symbols-outlined {
  font-size: 16px;
}

/* 버튼이 비동기 작업 중일 때(저장/추가/삭제 등) — 그냥 disabled로 조용히
   막아두면 클릭이 씹혔는지 알 수 없으므로, 항상 스피너 + "처리 중" 문구로
   "지금 진행 중"임을 보여준다. currentColor를 써서 버튼 종류(흰 글씨의
   primary든, 어두운 글씨의 secondary/danger든) 상관없이 그 버튼의 글자색을
   그대로 따라간다. */
.btn-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  opacity: 0.85;
  flex-shrink: 0;
  animation: btn-spinner-spin 0.6s linear infinite;
}

@keyframes btn-spinner-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn[aria-busy="true"] {
  cursor: progress;
}

/* disabled 상태의 흐림 처리는 "처리 중" 스피너 버튼엔 적용 안 함 — 흐려지면
   오히려 "지금 진행 중"이라는 신호가 약해 보인다. */
.btn:disabled[aria-busy="true"] {
  opacity: 1;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 9px;
  font-size: 11.5px;
}

.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-1);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-1);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--surface-2);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-bg-hover);
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-icon:hover:not(:disabled) {
  background: var(--surface-1);
  color: var(--text-primary);
}

.btn-icon.btn-sm {
  width: 26px;
  height: 26px;
}

.btn-icon .material-symbols-outlined {
  font-size: 19px;
}

.btn-icon.btn-sm .material-symbols-outlined {
  font-size: 16px;
}

/* "새로 추가" 계열 버튼(카드 추가/단계 추가 등) 전용 — 점선 테두리로 "여기 누르면
   새로 생긴다"는 느낌을 통일해서 준다. */
.btn-dashed {
  background: var(--surface-1);
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  justify-content: flex-start;
}

.btn-dashed:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: #c9c7bd;
}

/* 버튼이 아닌 요소(a, summary)도 눈에 띄게 포커스되도록 */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand-primary, #0f6e56);
  outline-offset: 2px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", sans-serif;
  background: var(--surface-1);
  color: var(--text-primary);
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-box {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-tint-text);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface-1);
  margin-left: -6px;
  font-weight: 600;
}

.avatar:first-child {
  margin-left: 0;
}

.avatar-muted {
  background: #eceae2;
  color: var(--text-secondary);
}

.brand-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.logout-link {
  color: var(--text-muted);
}

.logout-link:hover:not(:disabled) {
  color: var(--text-primary);
}

.logout-link .material-symbols-outlined {
  font-size: 16px;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 320px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 28px;
  text-align: center;
}

.login-logo {
  margin: 0 auto 16px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  border-radius: 10px;
}

.login-title {
  font-size: 18px;
  margin: 0 0 8px;
}

.login-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 24px;
}

.login-error {
  font-size: 12px;
  color: #a23c3c;
  background: #fbeaea;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 16px;
  line-height: 1.5;
}

.google-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.google-login-button:hover {
  border-color: #c9c7bd;
  background: var(--surface-1);
}

.onboarding-card {
  max-width: 380px;
  text-align: left;
}

.onboarding-card .login-logo,
.onboarding-card .login-title,
.onboarding-card .login-desc {
  text-align: center;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.optional-tag {
  font-weight: 400;
  color: var(--text-muted);
}

.form-field input,
.form-field select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.photo-field {
  align-items: center;
}

.photo-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}

.photo-preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-1);
  border: 1px solid var(--border);
}

.photo-picker input[type='file'] {
  flex: 1;
  font-size: 12px;
  border: none;
  padding: 0;
}

.radio-row {
  display: flex;
  gap: 16px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.ceo-note {
  font-size: 12px;
  color: var(--brand-tint-text);
  background: var(--brand-tint);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
}

.onboarding-submit {
  border: none;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
  margin-top: 4px;
}

.onboarding-submit:hover {
  background: var(--brand-primary);
  opacity: 0.92;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: grid;
  grid-template-columns: 64px 240px 1fr;
  align-items: stretch;
  min-height: calc(100vh - 57px);
}

.sidebar-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}

.rail-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
}

.rail-item:hover {
  background: var(--surface-1);
}

.rail-item.active {
  background: var(--brand-tint);
  color: var(--brand-tint-text);
}

.rail-item-disabled {
  color: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.sidebar-projects {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
}

.sidebar-projects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 8px 10px;
}

.new-project-btn {
  color: var(--brand-primary);
  text-transform: none;
  letter-spacing: normal;
}

.new-project-btn:hover:not(:disabled) {
  background: var(--brand-tint);
  color: var(--brand-tint-text);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 8px 4px;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.star-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.star-btn:hover:not(:disabled) {
  background: var(--surface-1);
  color: #c99a1f;
}

.star-btn.active {
  color: #e0a400;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  flex: 1;
  min-width: 0;
}

.project-item:hover {
  background: var(--surface-1);
}

.project-item.active {
  background: var(--brand-tint);
  color: var(--brand-tint-text);
  font-weight: 600;
}

.project-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.project-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-page { max-width: 920px; margin: 0 auto; padding: 28px 20px 60px; }
.directory-nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.directory-nav a[aria-current="page"] { color: var(--brand-primary); font-weight: 700; }
.directory-search, .directory-editor { display: grid; gap: 10px; margin: 20px 0; }
.directory-search > div { display: flex; gap: 8px; }
.directory-search input, .directory-editor input { min-width: 0; max-width: 430px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; }
.directory-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.directory-person { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 5px; }
.directory-person strong { font-size: 15px; }
.directory-person small { color: var(--text-muted); overflow-wrap: anywhere; }
.directory-editor { border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.profile-summary { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 10px 18px; overflow-wrap: anywhere; }
.profile-summary dt { color: var(--text-muted); }
.profile-summary dd { margin: 0; }
.group-list { display: grid; gap: 1rem; margin-top: 1rem; }
.group-section { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.group-section h2, .group-section ul { flex-basis: 100%; }
.group-section select, .group-section input { min-height: 2.5rem; max-width: 18rem; }

.project-add-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.project-add-form input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 12px;
}

.project-add-form button {
  padding: 7px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}

.project-add-form button:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.empty-state {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
  padding: 40px 0;
  text-align: center;
}

.board-main {
  padding: 24px 32px 48px;
  overflow-x: auto;
  position: relative;
  min-height: 200px;
}

/* 프로젝트 전환 로딩: 예전엔 전체를 반투명 스피너로 덮었는데, 그러면 사이드바까지
   눈에 안 들어오는 느낌이 들어서 상단 얇은 진행바로 바꿈 — 기존 보드는 그대로 보이고
   인터랙션도 안 막힌 채로, "지금 뭔가 일어나고 있다"만 알려준다. */
.board-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  background: var(--brand-tint);
  z-index: 5;
  border-radius: 0 0 3px 3px;
}

.board-loading-bar[hidden] {
  display: none;
}

/* 로딩 중엔 이전 프로젝트의 보드 내용을 살짝 흐리게(비활성화)만 하고,
   사이드바/프로젝트바는 절대 건드리지 않는다 — #board-content 안쪽에만 적용. */
#board-content.board-content--loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.board-loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -30%;
  width: 30%;
  background: var(--brand-primary);
  animation: board-loading-slide 0.9s ease-in-out infinite;
}

@keyframes board-loading-slide {
  0% {
    left: -30%;
  }
  60% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

/* 상단 얇은 진행바만으로는 "지금 로딩 중"이라는 게 잘 안 보인다는 피드백을 반영 —
   전환이 조금이라도 걸리면(약 150ms 이상) 눈에 확실히 띄는 배지 + 보드 모양
   스켈레톤으로 바뀐다. 여전히 #board-content 안쪽에서만 일어나고 사이드바/
   프로젝트바는 전혀 건드리지 않는다. */
.board-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 16px;
}

.skeleton-block {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-1) 37%,
    var(--surface-2) 63%
  );
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-column .skeleton-title {
  height: 14px;
  width: 55%;
  margin-bottom: 14px;
}

.skeleton-column .skeleton-card {
  height: 62px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: 200px 0;
  }
}

.board-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.publication-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.publication-status-card .settings-hint { margin: 4px 0 0; }
.publication-status-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .publication-status-card { align-items: flex-start; flex-direction: column; }
}

.board-title {
  font-size: 17px;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 칸반 보드: 단계가 늘어나도 절대 다음 줄로 안 넘어가고 한 줄을 유지한다 —
   화면보다 넓어지면 보드 자체가 가로 스크롤된다(그리드+줄바꿈 대신 flex 한 줄). */
.board {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px; /* 스크롤바가 카드 위에 안 겹치게 여유 확보 */
}

.task-view-switch {
  display: flex;
  gap: 6px;
  margin: 14px 0;
}

.task-view-switch [aria-pressed="true"] {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.board[data-view="list"] {
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: visible;
  gap: 22px;
}

.board[data-view="list"] .board-column {
  width: 100%;
  min-width: 0;
  flex-basis: auto;
}

.board[data-view="list"] .column-cards {
  gap: 6px;
}

.board[data-view="list"] .card {
  width: 100%;
}

.my-work-projects {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 200px;
  padding: 24px 14px;
  border-right: 1px solid var(--border);
}

.my-work-projects a { color: var(--text-primary); text-decoration: none; }
.my-work-main { flex: 1; min-width: 0; max-width: 1100px; padding: 28px; overflow: auto; }
.my-work-search { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.my-work-search input { min-width: 220px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.my-work-section { margin: 28px 0; }
.my-work-section h2 { font-size: 17px; }
.my-work-row { display: flex; gap: 14px; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-primary); text-decoration: none; }
.my-work-row:hover { background: var(--surface-1); }
.my-work-row span:first-child { min-width: 140px; color: var(--text-muted); }
.my-work-row strong { flex: 1; }
.capture-notes { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 50ch; }
@media (max-width: 700px) {
  .my-work-projects { display: none; }
  .my-work-main { padding: 16px; }
  .my-work-row { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (max-width: 700px) {
  .board[data-view="board"] .board-column { flex-basis: min(82vw, 300px); width: min(82vw, 300px); min-width: min(82vw, 300px); }
}

.board::-webkit-scrollbar {
  height: 8px;
}

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

.board::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.board::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.board-column {
  flex: 0 0 272px;
  width: 272px;
  min-width: 272px;
  display: flex;
  flex-direction: column;
}

.column-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 10px;
}

.column-label {
  font-size: 13px;
  font-weight: 600;
}

.column-count {
  font-size: 12px;
  color: var(--text-muted);
}

.column-bar {
  height: 3px;
  border-radius: 2px;
  margin-bottom: 12px;
  background: var(--brand-primary);
  opacity: 0.8;
}

.card-add-btn {
  margin-bottom: 12px;
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: #c9c7bd;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.card-title {
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.card-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-id {
  font-size: 11px;
  color: var(--text-muted);
}

.card-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #eceae2;
  color: var(--text-secondary);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 64px 200px 1fr;
  }
}

@media (max-width: 560px) {
  .board {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 56px 1fr;
  }

  .sidebar-projects .project-name {
    display: none;
  }
}

.app-shell--no-projects {
  grid-template-columns: 64px 1fr;
}

.guest-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: #fff3cd;
  color: #8a6d00;
}

.custom-input {
  margin-top: 6px;
}

.custom-input[hidden] {
  display: none;
}

.people-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
}

.person-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 14px;
}

.person-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
}

.person-summary::-webkit-details-marker {
  display: none;
}

.person-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.person-name {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.person-team-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-1);
  padding: 2px 8px;
  border-radius: 6px;
}

.person-detail {
  border-top: 1px solid var(--border);
  padding: 12px 0 14px;
}

.person-fields {
  display: grid;
  grid-template-columns: 64px 1fr;
  row-gap: 8px;
  column-gap: 12px;
  margin: 0;
}

.person-fields dt {
  font-size: 12px;
  color: var(--text-muted);
}

.person-fields dd {
  font-size: 13px;
  margin: 0;
}

.employee-id-form {
  display: flex;
  gap: 6px;
}

.employee-id-form input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  width: 120px;
}

.employee-id-form button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  cursor: pointer;
  font-size: 12px;
}

/* 프로젝트 그룹(폴더) */
.project-group {
  margin-bottom: 2px;
}

.project-group-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 8px;
  cursor: pointer;
  list-style: none;
}

.project-group-name::-webkit-details-marker {
  display: none;
}

/* 비활성화된 프로젝트 목록 — 평소엔 눈에 덜 띄게, 열어야 내용이 보이게 */
.archived-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.archived-group > .project-group-name {
  color: var(--text-muted);
}

.archived-group .project-item {
  opacity: 0.7;
}

.group-add {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.group-add-summary {
  color: var(--text-muted);
  list-style: none;
  width: fit-content;
}

.group-add-summary::-webkit-details-marker {
  display: none;
}

.group-add-form {
  display: flex;
  gap: 6px;
  padding: 6px 8px 0;
}

.group-add-form input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

/* 프로젝트 생성 팝업 (dialog) */
.modal-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  color: var(--text-primary);
  background: var(--surface-2);
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 15px;
  margin: 0;
}

.modal-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.modal-close .material-symbols-outlined {
  font-size: 20px;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-error {
  font-size: 12px;
  color: var(--danger-text);
  background: var(--danger-bg-hover);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
}

.modal-progress-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-1);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
}

.nav-loading-spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  flex-shrink: 0;
}

.modal-actions {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.modal-actions .btn {
  flex: 1;
}

/* ---- 커스텀 체크박스 ----
   브라우저 기본 체크박스 대신 쓰는 공용 컴포넌트. 실제 <input>은 화면에서
   지우지 않고(opacity:0) 자리만 겹쳐두는 방식이라 키보드 포커스/Space 토글/
   스크린리더 등 접근성은 네이티브 체크박스 그대로 유지되고, 보이는 상자
   (.checkbox-box)만 디자인 시스템에 맞게 새로 그린다. */
.checkbox-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-input {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  transform: translateY(-50%); /* 라벨 줄 높이가 16px보다 커도 보이는 .checkbox-box와 정확히 겹치게 */
}

.checkbox-box {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.checkbox-option:hover .checkbox-box {
  border-color: var(--brand-primary);
}

.checkbox-input:checked + .checkbox-box {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.checkbox-input:checked + .checkbox-box::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.checkbox-input:focus-visible + .checkbox-box {
  outline: 2px solid var(--brand-primary, #0f6e56);
  outline-offset: 2px;
}

.checkbox-input:disabled + .checkbox-box {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-input:disabled ~ * {
  cursor: not-allowed;
}

.checkbox-option:has(.checkbox-input:disabled) {
  color: var(--text-muted);
}

/* ---- 멤버 선택 피커 (생성 팝업 + 설정 > 멤버 추가 공용) ----
   팀별로 묶어서 보여주고, 그 안에서 개인을 고를 수 있게 한다. */
.member-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-option {
  font-size: 12.5px;
  padding: 3px 2px;
}

.member-option-all {
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.member-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-primary);
}

.member-search-input:focus-visible {
  outline: 2px solid var(--brand-primary, #0f6e56);
  outline-offset: 1px;
}

.member-picker-teams {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.member-team-group {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.member-team-group:first-child {
  border-top: none;
  padding-top: 0;
}

.member-team-header {
  font-weight: 700;
  font-size: 11.5px;
}

.member-team-header-label {
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.member-team-header-static {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  padding: 3px 2px;
}

.member-team-count {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 11px;
}

.member-team-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-left: 24px;
}

/* 프로젝트 설정 (모달 안 내용) — 담을 내용이 많아서(기본/멤버/단계) 기존 팝업
   크기론 좁았다. 모달 자체를 크게 키우되, 늘어나는 건 안쪽 콘텐츠 영역만이고
   페이지 전체가 스크롤되진 않는다: 헤더는 항상 고정, 왼쪽 탭 내비게이션도
   고정, 오른쪽 콘텐츠(.settings-content)만 그 안에서 스크롤된다. */
.settings-dialog {
  width: 860px;
  max-width: calc(100vw - 48px);
}

.settings-dialog .modal-body {
  padding: 0;
  height: min(680px, calc(100vh - 160px));
  max-height: none;
  overflow: hidden;
  display: block;
}

.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding: 20px;
  height: 100%;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
  padding-right: 16px;
}

.settings-content {
  min-height: 0; /* grid 자식이 내용만큼 커지지 않고 실제로 스크롤되게 하는 핵심 */
  overflow-y: auto;
  padding-right: 8px;
}

@media (max-width: 640px) {
  .settings-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 10px;
  }
  .settings-dialog .modal-body {
    height: min(80vh, 720px);
    overflow-y: auto;
  }
  .settings-content {
    overflow-y: visible;
  }
}

.settings-nav-item {
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
}

.settings-nav-item:hover {
  background: var(--surface-1);
}

.settings-nav-item.active {
  background: var(--brand-tint);
  color: var(--brand-tint-text);
  font-weight: 600;
}

.settings-panel-title {
  font-size: 15px;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.admin-note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-1);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 14px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
}

.settings-form textarea {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.settings-form select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface-2);
}

.settings-save-btn {
  align-self: flex-start;
}

.settings-subtitle {
  font-size: 13px;
  margin: 24px 0 10px;
}

.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.settings-static-value {
  font-size: 13px;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-1);
  color: var(--text-secondary);
}

.role-badge.owner {
  background: var(--brand-tint);
  color: var(--brand-tint-text);
}

.role-badge.admin {
  background: #fff3cd;
  color: #8a6d00;
}

.member-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 단계 관리 */
#stages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.stage-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-row input[type='text'] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.stage-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* 페이지 이동 로딩 오버레이 */
.nav-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247, 246, 242, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.nav-loading-overlay[hidden] {
  display: none;
}

.nav-loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: nav-loading-spin 0.7s linear infinite;
}

@keyframes nav-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Card editing uses a keyboard-accessible form for create/edit/stage moves. */
#card-form input, #card-form select { width: 100%; box-sizing: border-box; }
.history-dialog { width: min(800px, calc(100vw - 32px)); }
.activity-entry { padding: 16px 0; border-bottom: 1px solid var(--border); }
.activity-entity { font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; }
.activity-change { display: grid; grid-template-columns: 85px 1fr; gap: 10px; margin: 8px 0; }
.activity-change dt { color: var(--text-muted); }
.activity-change dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.activity-pages { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 16px; }
.activity-pages button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.activity-pages button:hover { background: var(--surface-1); color: var(--text-primary); }
