/* ── 공통 변수 ──────────────────────────────────────── */
:root {
  --primary: #4f7fff;
  --primary-dark: #3a66e0;
  --danger: #e55;
  --gray: #888;
  --bg: #f0f7ff;
  --white: #fff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; word-break: break-word; overflow-wrap: break-word; }
body { font-family: 'Segoe UI', sans-serif; background: #f0f7ff; color: #333; }

a { color: var(--primary); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }

input, textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid #dde; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 10px;
  background: #fafafa; transition: border .2s;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
textarea { height: 80px; resize: vertical; }
input:disabled { background: #eee; color: var(--gray); }

button {
  padding: 10px 20px; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 14px; background: #eee; transition: background .2s;
}
button:hover { background: #ddd; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c33; }

.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 6px; }

/* ── 인증 페이지 (로그인, 프로필) ───────────────────── */
.auth-page {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh;
}
.auth-card {
  background: var(--white); border-radius: 16px;
  box-shadow: var(--shadow); padding: 40px 36px;
  width: 100%; max-width: 380px;
}
.auth-card h1 { font-size: 24px; text-align: center; margin-bottom: 24px; color: var(--primary); }
.auth-card h2 { font-size: 18px; margin-bottom: 20px; }
.switch-link { font-size: 13px; text-align: center; margin-top: 12px; color: var(--gray); }
.switch-link a { margin-left: 4px; }

/* ── 헤더 ────────────────────────────────────────────── */
header {
  background: var(--white); padding: 14px 32px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100;
}
header span { font-weight: 600; color: var(--primary); }
header nav { display: flex; gap: 16px; align-items: center; }
header nav a { font-size: 14px; }

/* ── 메인 ────────────────────────────────────────────── */
main { padding: 28px 32px; }
.board-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}

/* ── 칸반 보드 ───────────────────────────────────────── */
.kanban { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.column {
  background: var(--white); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow); min-height: 400px;
}
.column h3 { font-size: 15px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--bg); }

.card-list { display: flex; flex-direction: column; gap: 10px; }

/* 할 일 카드 */
.todo-card {
  background: var(--bg); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: box-shadow .2s;
  border-left: 4px solid #ccc;
}
.todo-card:hover { box-shadow: 0 4px 16px rgba(79,127,255,0.15); }
.todo-card.ready  { border-left-color: #aac; }
.todo-card.doing  { border-left-color: var(--primary); }
.todo-card.done   { border-left-color: #4c4; opacity: .75; }

.todo-card .card-title    { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.todo-card .card-assignee { font-size: 12px; color: var(--gray); }
.todo-card .card-deadline { font-size: 12px; color: var(--gray); margin-top: 4px; }

.status-btns { display: flex; gap: 6px; margin-top: 10px; }
.status-btns button { padding: 4px 10px; font-size: 12px; border-radius: 20px; }

/* ── 모달 ────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4); display: flex;
  align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--white); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 420px; box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 18px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ── 상세 페이지 ─────────────────────────────────────── */
.detail-meta {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 16px; font-size: 14px;
}

/* ── 반응형 ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .kanban { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

/* ── 프로젝트 목록 ───────────────────────────────────── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.project-card {
  background: var(--white); border-radius: 14px;
  padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  min-width: 280px;
}
.project-card .proj-btns {
  display: flex; gap: 8px; flex-wrap: nowrap; align-items: center;
}
.project-card .proj-btns button {
  white-space: nowrap; flex-shrink: 0;
}
.proj-title { font-size: 17px; font-weight: 600; }
.proj-meta  { font-size: 13px; color: var(--gray); }
.proj-btns  { display: flex; gap: 8px; margin-top: 4px; flex-wrap: nowrap; }
.proj-btns button { white-space: nowrap; }

/* ── 팀원 테이블 ─────────────────────────────────────── */
.member-table-wrap { background: var(--white); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.member-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.member-table th { text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--bg); color: var(--gray); font-weight: 500; }
.member-table td { padding: 12px 14px; border-bottom: 1px solid var(--bg); }
.member-table td button { margin-right: 6px; padding: 5px 12px; font-size: 12px; }

/* ── 활동 히스토리 ───────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-item {
  background: var(--white); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: center;
}
.log-main  { font-size: 14px; }
.log-todo  { color: var(--primary); font-weight: 500; }
.log-time  { font-size: 12px; color: var(--gray); white-space: nowrap; margin-left: 16px; }

/* ── 탭 ─────────────────────────────────────────────── */
.tab-wrap {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.tab {
  padding: 10px 24px; border-radius: 20px;
  font-size: 14px; font-weight: 500;
  background: #eee; color: var(--gray);
  border: none; cursor: pointer; transition: all .2s;
}
.tab.active {
  background: var(--primary); color: #fff;
}
.tab:hover:not(.active) { background: #ddd; }
.card-content {
  font-size: 13px;
  color: var(--gray);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  margin-bottom: 6px;
}

/* ── 프로필 페이지 ───────────────────────────────────── */
.profile-card {
  background: var(--white); border-radius: 16px;
  box-shadow: var(--shadow); padding: 32px;
  max-width: 480px; margin: 40px auto;
  display: flex; flex-direction: column; gap: 16px;
}
.profile-header {
  display: flex; align-items: center; gap: 12px;
}
.profile-header h2 { font-size: 22px; }
.profile-badge {
  background: var(--primary); color: #fff;
  padding: 3px 10px; border-radius: 20px; font-size: 12px;
}
.profile-info {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg); border-radius: var(--radius); padding: 16px;
}
.info-row {
  display: flex; justify-content: space-between;
  font-size: 14px;
}
.info-row span { color: var(--gray); }

.header-logo {
  font-size: 18px; font-weight: 700;
  color: var(--primary); text-decoration: none;
}
.header-logo:hover { text-decoration: none; opacity: 0.8; }

/* ── 프로필 드롭다운 ─────────────────────────────────── */
.profile-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer;
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.profile-dropdown {
  position: fixed; top: 56px; right: 24px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  padding: 20px; min-width: 200px;
  display: none; flex-direction: column; gap: 12px;
  z-index: 999;
}
.profile-dropdown.open { display: flex; }
.dropdown-name { font-weight: 600; font-size: 15px; }
.dropdown-id   { font-size: 12px; color: var(--gray); }
.dropdown-divider { border: none; border-top: 1px solid #eee; margin: 4px 0; }
.dropdown-btn {
  padding: 8px 12px; border-radius: 8px;
  font-size: 13px; text-align: left;
  background: none; border: none; cursor: pointer;
  transition: background .15s; width: 100%;
}
.dropdown-btn:hover { background: #f0f7ff; }
.dropdown-btn.danger { color: var(--danger); }
.dropdown-btn.danger:hover { background: #fff0f0; }

/* ── 완료 카드 축약형 ────────────────────────────────── */
.todo-card.compact {
  padding: 10px 14px;
  opacity: 0.7;
}
.todo-card.compact .card-title {
  font-size: 13px;
  text-decoration: line-through;
  color: var(--gray);
}
.todo-card.compact .card-deadline {
  font-size: 11px;
}

.proj-dday {
  font-size: 13px; font-weight: 600;
  color: var(--primary);
}

/* ── 모바일 반응형 ───────────────────────────────────── */
@media (max-width: 768px) {
  /* 헤더 */
  header { padding: 12px 16px; }

  /* 메인화면 3단 → 1단 */
  .main-grid { grid-template-columns: 1fr; padding: 16px; }

  /* 칸반 2열 → 1열 */
  .kanban { grid-template-columns: 1fr; }

  /* 프로젝트 카드 */
  .project-grid { grid-template-columns: 1fr; }

  /* 탭 스크롤 가능하게 */
  .tab-wrap { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tab { flex-shrink: 0; }

  /* 보드 헤더 */
  .board-header { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* 메인 패딩 */
  main { padding: 16px; }

  /* 프로필 드롭다운 */
  .profile-dropdown { right: 8px; }

  /* 로그인 카드 */
  .auth-card { padding: 28px 20px; }

  /* 멤버 테이블 글씨 */
  .member-table { font-size: 12px; }
  .member-table td button { padding: 4px 8px; font-size: 11px; }
}

/* ── 프로젝트 상세 ───────────────────────────────────── */
.detail-stat {
  background: #f0f7ff; border-radius: 12px;
  padding: 18px 14px; text-align: center;
  transition: background .2s;
}
.detail-stat:hover { background: #dceeff; }
.stat-label { font-size: 12px; color: var(--gray); margin-bottom: 8px; }
.stat-value { font-size: 18px; font-weight: 700; color: #333; }

/* ── 섹션 구분선 ─────────────────────────────────────── */
.section-card {
  background: #fff; border-radius: 16px;
  box-shadow: var(--shadow); padding: 24px;
  margin-bottom: 16px;
}
.section-card h4 {
  font-size: 13px; color: var(--gray);
  margin-bottom: 12px; font-weight: 500;
}

/* ── 알림 ───────────────────────────────────────────── */
.notif-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 1px solid var(--color-border-tertiary);
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.notif-dropdown {
  position: fixed; top: 56px; right: 70px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  padding: 16px; min-width: 280px;
  display: none; flex-direction: column; gap: 10px;
  z-index: 999;
}
.notif-dropdown.open { display: flex; }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.notif-item {
  background: #f0f7ff; border-radius: 10px;
  padding: 12px 14px; display: flex;
  flex-direction: column; gap: 8px;
}
.notif-item-title { font-size: 13px; font-weight: 500; }
.notif-item-sub { font-size: 12px; color: #888; }
.notif-btns { display: flex; gap: 6px; }
.notif-btns button { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.notif-empty { font-size: 13px; color: var(--gray); text-align: center; padding: 8px 0; }
.notif-tab-wrap { display: flex; gap: 4px; margin-bottom: 10px; }
.notif-tab {
  flex: 1; padding: 6px; border-radius: 8px;
  border: none; background: #eee; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--gray);
  transition: all .2s;
}
.notif-tab.active { background: var(--primary); color: #fff; }

.expired-card {
  opacity: 0.7;
  border-left: 3px solid var(--danger) !important;
  background: #fff5f5 !important;
}

.notif-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; margin-left: 4px;
}

.todo-card-content {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}