/* ===== 페이지 머리 ===== */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 18px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.035em; color: var(--brand-900); }
.head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.sec-title { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 4px 12px; }
.sec-title h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; color: var(--brand-900); }
.link-more { font-size: 14px; font-weight: 600; color: var(--brand-700); }
.hint { font-size: 13px; color: var(--text-3); }
@media (pointer: coarse) { .desktop-only { display: none; } }

/* ===== 로그인 화면 (아이디가 없으면 여기까지만) ===== */
.gate { min-height: calc(100vh - var(--top) - 120px); display: grid; place-items: center; }
.gate-card { width: min(380px, 100%); padding: 32px 26px 26px; text-align: center; }
.gate-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 10px; }
.gate-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.03em; color: var(--brand-900); }
.gate-card .big { font-size: 40px; }
.gate-sub { margin: 0 0 22px; font-size: 14px; color: var(--text-3); }
.gate-form { text-align: left; }
.gate-btn { width: 100%; margin-top: 4px; }
.gate-link { display: inline-block; margin-top: 16px; }

/* 로그인 / 가입하기 */
.gate-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  margin: 18px 0 22px; padding: 4px;
  background: var(--surface-2); border-radius: var(--r-md);
}
.gate-tab {
  border: 0; background: none; cursor: pointer;
  padding: 9px 4px; border-radius: 12px;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--text-3);
  transition: background .18s, color .18s, box-shadow .18s;
}
.gate-tab.on { background: var(--surface); color: var(--brand-800); box-shadow: 0 1px 4px rgba(43, 66, 112, .12); }

/* 가입 칸 사이 구분선 */
.gate-div { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; }
.gate-div::before, .gate-div::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gate-div span { font-size: 12px; font-weight: 700; color: var(--text-3); }
.gate-note { margin: 14px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-3); }

/* 초대 코드 카드 (아이디 관리) */
.invite-card { text-align: center; }
.invite-code {
  font-size: 30px; font-weight: 800; letter-spacing: 0.14em;
  color: var(--brand-800); font-variant-numeric: tabular-nums;
}
.invite-sub { margin: 6px 0 14px; font-size: 13px; color: var(--text-3); }
.gate-msg { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--coral-100); color: #B64A3D; font-size: 13px; font-weight: 700; }
body.gate-mode .burger, body.gate-mode .gear, body.gate-mode .mascot { display: none; }

/* ===== 카드 · 그리드 ===== */
.card {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow); padding: 22px;
  border: 1px solid rgba(226, 234, 245, .7);
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* 홈 인사 카드 (하늘색 + 볼 분홍 + 치즈 노랑 동그라미) */
.hero {
  position: relative; overflow: hidden; padding: 28px 30px;
  background: linear-gradient(135deg, #D3E6FD 0%, #EAF3FF 55%, #FFF3E2 100%);
  border: 1px solid rgba(181, 211, 246, .7);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 240px; height: 240px; right: -70px; top: -90px; background: radial-gradient(circle, rgba(247, 193, 188, .6), rgba(247, 193, 188, 0) 70%); }
.hero::after { width: 200px; height: 200px; right: 110px; bottom: -120px; background: radial-gradient(circle, rgba(254, 239, 176, .9), rgba(254, 239, 176, 0) 70%); }
.hero > * { position: relative; z-index: 1; }
.hero p { margin: 0; color: var(--text-2); }
.hero .hero-lead { margin: 0 0 6px; font-size: clamp(22px, 3vw, 30px); font-weight: 800; letter-spacing: -0.035em; color: var(--brand-900); }
.hero-lead b { color: var(--brand-700); background: linear-gradient(transparent 62%, var(--cheese) 62%); padding: 0 2px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-chips > * {
  padding: 6px 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; color: var(--brand-900);
  background: rgba(255, 255, 255, .78); border: 1px solid rgba(255, 255, 255, .95); box-shadow: var(--shadow-sm);
}
.hero-chips a { transition: background .15s; }
.hero-chips a:hover { background: #fff; }

/* ===== 프로젝트 카드 ===== */
.pcard { display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s; }
.pcard:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(43,66,112,.05), 0 18px 40px rgba(43,66,112,.12); }
.pcard:active { transform: scale(.985); }
.pcard-top { display: flex; align-items: center; gap: 12px; }
.emoji-tile {
  flex: none; width: 52px; height: 52px; border-radius: 16px; font-size: 28px;
  display: grid; place-items: center; background: var(--brand-50);
}
.emoji-tile.sm { width: 44px; height: 44px; font-size: 24px; border-radius: 14px; }
.pcard h3 { margin: 0; font-size: 17px; letter-spacing: -0.02em; color: var(--brand-900); }
.pcard .desc { margin: 0; color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-3); }

/* 진행 바 */
.progress { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 10px; border-radius: 6px; background: var(--brand-50); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-300), var(--brand-600)); transition: width .5s var(--ease); }
.progress b { font-size: 14px; min-width: 40px; text-align: right; color: var(--brand-700); }

/* 상태 알약 */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.plan { background: #EEF2F8; color: var(--text-2); }
.pill.doing { background: var(--brand-100); color: var(--brand-800); }
.pill.done { background: var(--honey-100); color: #946513; }
.pill.hold { background: var(--pink-100); color: #B0505E; }
.pill.pin { background: var(--coral-100); color: #B64A3D; }
.pill.open { background: var(--brand-100); color: var(--brand-800); }
.pill.closed { background: #EEF2F8; color: var(--text-2); }

/* ===== 버튼 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform .15s var(--ease), filter .15s, background .15s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--brand-700); color: #fff; box-shadow: 0 6px 16px rgba(66, 115, 184, .3); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.soft { background: var(--brand-100); color: var(--brand-900); }
.btn.ghost { background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.btn.danger { background: var(--coral-100); color: #B64A3D; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--coral-100); color: #B64A3D; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 자료실 내려받기 버튼 */
.dl-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.text-btn { font-size: 13px; font-weight: 700; color: var(--brand-700); }
.text-btn:hover { text-decoration: underline; }

/* ===== 리스트 (iOS 그룹 리스트) ===== */
.list { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden; border: 1px solid rgba(226,234,245,.7); }
.li { display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; transition: background .15s; position: relative; }
.li + .li::before { content: ""; position: absolute; top: 0; left: 74px; right: 0; height: 1px; background: var(--line); }
.li:hover { background: var(--surface-2); }
.li-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--brand-50); overflow: hidden; }
.li-ico img { width: 100%; height: 100%; object-fit: cover; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.li-title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-title .who { font-size: 13px; font-weight: 600; color: var(--text-3); }
.li-sub { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--text-3); font-size: 18px; }

/* 빈 상태 (만들기는 메뉴에서 하도록 안내) */
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.empty p { margin: 0 0 16px; line-height: 1.7; }
.empty p:last-child { margin-bottom: 0; }
.empty b { color: var(--brand-700); }

/* ===== 프로젝트 상세: 얇은 정보 줄 + 진행 기록 카드 ===== */
.back { display: inline-block; margin: 0 0 10px 4px; }
.proj-head { padding: 14px 18px 16px; }
.ph-top { display: flex; align-items: center; gap: 12px; }
.ph-info { flex: 1; min-width: 0; }
.ph-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ph-title h1 {
  margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(18px, 2.2vw, 22px); letter-spacing: -0.03em; color: var(--brand-900);
}
.ph-meta { margin-top: 2px; font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.ph-actions .btn { margin-right: 4px; }
.icon-btn.edit:hover { background: var(--brand-50); color: var(--brand-900); }
.ph-progress { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.ph-pct { min-width: 44px; text-align: right; font-size: 15px; color: var(--brand-700); }

/* 진행률: 막대를 그대로 끌어서 조절 */
.pslider {
  -webkit-appearance: none; appearance: none; flex: 1; height: 12px; margin: 0; border-radius: var(--r-pill); cursor: pointer;
  background: linear-gradient(90deg, var(--brand-300), var(--brand-600)) 0 / var(--val, 0%) 100% no-repeat, var(--brand-50);
}
.pslider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand-600); box-shadow: 0 2px 6px rgba(43, 66, 112, .25);
}
.pslider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-600); box-shadow: 0 2px 6px rgba(43, 66, 112, .25); }
.pslider::-moz-range-track { background: transparent; }

/* 진행 기록 카드: 날짜 + 제목만, 누르면 내용 */
.log-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.log-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 100px;
  padding: 14px 16px; border-radius: var(--r-lg); text-align: left;
  background: var(--surface); border: 1px solid rgba(226, 234, 245, .8); box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.log-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(43, 66, 112, .05), 0 14px 30px rgba(43, 66, 112, .12); }
.log-date { font-size: 12px; font-weight: 800; color: var(--brand-700); background: var(--brand-50); padding: 3px 10px; border-radius: var(--r-pill); }
.log-title {
  font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--brand-900); word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.log-meta { margin-top: auto; font-size: 12px; color: var(--text-3); }
.log-card.log-add {
  align-items: center; justify-content: center; gap: 6px; box-shadow: none;
  border: 2px dashed var(--brand-300); background: var(--brand-50); color: var(--brand-700); font-weight: 800;
}
.log-add .plus { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: #fff; box-shadow: var(--shadow-sm); }
.log-view-title { margin: 0 0 10px; font-size: 20px; letter-spacing: -0.03em; color: var(--brand-900); word-break: break-word; }
.log-view-text { margin-bottom: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
@media (max-width: 560px) {
  .ph-title { flex-wrap: wrap; row-gap: 2px; }
  .ph-actions .lbl { display: none; }
  .log-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .log-card { min-height: 92px; padding: 12px 14px; }
  .card { padding: 18px 16px; }
  .hero .hero-lead { font-size: 21px; }
  .hero-chips { gap: 6px; margin-top: 14px; }
  /* 좁으면 내려받기 버튼은 아이콘만 */
  .dl-text { display: none; }
  .dl-btn { padding: 0; width: 36px; height: 36px; justify-content: center; border-radius: 50%; }
  .li { gap: 12px; padding: 14px 14px; }
  .li + .li::before { left: 60px; }
}
@media (max-width: 400px) {
  .hero .hero-lead { font-size: 19px; }
  .hero-chips > * { padding: 7px 11px; font-size: 12.5px; }
}

/* 댓글 입력칸 */
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; }

/* ===== 폼 ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 700; color: var(--text-2); padding-left: 4px; }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r-md); padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .textarea:focus { border-color: var(--brand-500); background: #fff; box-shadow: 0 0 0 4px rgba(181, 211, 246, .45); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; min-width: 40px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px;
}
.chip.emoji { font-size: 20px; padding: 0 8px; }
label.chip, button.chip { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; transition: background .15s, border-color .15s; }
label.chip input { display: none; }
label.chip:has(input:checked), .chip.on { background: var(--brand-100); border-color: var(--brand-500); color: var(--brand-900); }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--brand-600); }
.search { max-width: 320px; }

/* ===== 모달 (모바일: 바텀시트 / PC: 가운데 카드) ===== */
.modal-root { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.modal-root.show { pointer-events: auto; }
.modal-scrim { position: absolute; inset: 0; background: rgba(30,45,75,.32); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s; }
.modal-root.show .modal-scrim { opacity: 1; }
.sheet {
  position: absolute; left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .4s var(--ease), opacity .25s;
}
.modal-root.show .sheet { transform: translate(-50%, -50%); opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 8px; }
.sheet-head h3 { margin: 0; font-size: 19px; letter-spacing: -0.03em; color: var(--brand-900); }
.sheet-body { padding: 8px 22px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 22px; }
.sheet-close { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; font-size: 16px; }

/* ===== 토스트 ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: rgba(43, 66, 112, .95); color: #fff; font-weight: 600; font-size: 14px;
  padding: 12px 20px; border-radius: var(--r-pill); box-shadow: var(--shadow-lg);
  transition: transform .35s var(--ease), opacity .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ===== 파일을 끌어다 놓을 때 ===== */
.drop-overlay {
  position: fixed; inset: 0; z-index: 85;
  display: grid; place-items: center;
  background: rgba(90, 143, 214, .18);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drop-overlay.show { opacity: 1; pointer-events: auto; }
.drop-overlay * { pointer-events: none; }
.drop-card {
  padding: 36px 48px; text-align: center; color: var(--brand-900);
  background: var(--surface); border: 2px dashed var(--brand-500);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.drop-card .big { font-size: 44px; margin-bottom: 6px; }

@media (max-width: 640px) {
  .sheet { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 88vh; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(100%); opacity: 1; padding-bottom: env(safe-area-inset-bottom); }
  .modal-root.show .sheet { transform: none; }
  .sheet::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
  .sheet-foot .btn { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding: 22px; }
  .hero-chips { gap: 6px; }
  .hero-chips span { font-size: 12px; padding: 5px 10px; }
}
