/* 칸 화면 스타일. 흰 바탕, 넉넉한 여백, 둥근 버튼, 주색상 남색. */
:root {
  --accent: #4f5bd5;
  --text: #1f2937;
  --sub: #6b7280;
  --line: #e5e7eb;
  --soft: #f3f4f6;
  --warn-bg: #ffedd5;
  --warn-fg: #9a3412;
  --sun: #b4532a;
  --danger: #b91c1c;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  color: var(--text);
  background: #fff;
  -webkit-text-size-adjust: 100%;
}
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; padding: 0; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#app { max-width: 480px; height: 100%; margin: 0 auto; }
.screen { height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }

/* 위쪽 머리줄 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 20px; }
.top h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: baseline; gap: 8px; }
.top h1 small { font-size: 15px; font-weight: 500; color: var(--sub); }
.top-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 22px; }
.icon-btn:active { background: var(--soft); }
.today-btn { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; font-size: 14px; font-weight: 500; margin: 0 4px; }
.avatar { position: relative; width: 40px; height: 40px; border-radius: 20px; background: var(--soft); font-size: 15px; font-weight: 700; margin-left: 4px; }
.avatar i { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 6px; border: 2px solid #fff; background: #15803d; }
.avatar i.pending { background: #d97706; }
.avatar i.offline { background: #9ca3af; }

/* 달력 */
.week, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0 12px; }
.week { height: 24px; align-items: center; text-align: center; font-size: 12px; font-weight: 500; color: var(--sub); }
.week span:first-child { color: var(--sun); }
.day { height: 58px; padding-top: 2px; display: flex; flex-direction: column; align-items: center; gap: 1px; overflow: hidden; }
.day b { width: 30px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 500; border: 2px solid transparent; }
.day.sun b { color: var(--sun); }
.day.other b { color: #6f7480; font-weight: 400; }
.day.selected b { border-color: var(--accent); }
.day.today b { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.bars { display: flex; gap: 2px; height: 4px; }
.bars i { width: 8px; height: 4px; border-radius: 2px; }

/* 할일 목록 */
.list-wrap { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--line); margin-top: 6px; -webkit-overflow-scrolling: touch; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 6px; }
.list-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.list-head span { font-size: 13px; color: var(--sub); }
.rows { padding: 0 8px 8px; }
.row { display: flex; align-items: center; min-height: 50px; }
.check { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; }
.check i { width: 22px; height: 22px; border: 2px solid #9ca3af; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.row.done .check i { background: var(--accent); border-color: var(--accent); }
.title-btn { flex: 1; min-width: 0; min-height: 44px; text-align: left; font-size: 16px; padding: 8px 4px 8px 0; overflow-wrap: anywhere; }
.row.done .title-btn { color: var(--sub); }
.row.done .title-btn .t, .row.sub.done .title-btn { text-decoration: line-through; }
.late { flex: none; font-size: 12px; font-weight: 500; color: var(--warn-fg); background: var(--warn-bg); border-radius: 10px; padding: 3px 8px; margin-right: 6px; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 5px; margin-right: 12px; }
.empty { padding: 18px 20px; color: var(--sub); font-size: 15px; }

/* 아래 입력줄 */
.add { display: flex; align-items: center; gap: 6px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)) 6px; border-top: 1px solid var(--line); background: #fff; }
.add input { flex: 1; min-width: 0; height: 46px; border: 1px solid #d1d5db; border-radius: 23px; padding: 0 18px; font-size: 16px; background: #f9fafb; }
.add .add-btn { width: 46px; height: 46px; flex: none; border-radius: 23px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 아래에서 올라오는 시트 */
.overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { width: 100%; max-width: 480px; max-height: 92%; overflow-y: auto; background: #fff; border-radius: 20px 20px 0 0; padding: 6px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-top { display: flex; justify-content: space-between; align-items: center; margin: 0 -10px; }
.text-btn { height: 44px; padding: 0 10px; font-size: 16px; font-weight: 500; }
.text-btn.danger { color: var(--danger); }
.sheet-title { width: 100%; border: 0; border-bottom: 2px solid var(--line); font-size: 22px; font-weight: 700; padding: 8px 0 10px; margin-bottom: 4px; background: transparent; border-radius: 0; }
.sheet-title:focus { outline: none; border-bottom-color: var(--accent); }
.field { display: flex; align-items: center; min-height: 56px; border-bottom: 1px solid var(--line); gap: 8px; }
.field > label, .field > .label { width: 96px; flex: none; font-size: 14px; color: var(--sub); }
.field input[type='date'] { height: 40px; border: 1px solid var(--line); border-radius: 20px; padding: 0 14px; font-size: 16px; background: #fff; }
.field.col { flex-direction: column; align-items: stretch; padding: 12px 0 8px; gap: 4px; }
.swatches { display: flex; justify-content: space-between; margin: 0 -7px; }
.swatch { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.swatch i { width: 28px; height: 28px; border-radius: 14px; }
.swatch.on i { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--text); }
.field.between { justify-content: space-between; min-height: 64px; }
.field .desc { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.field .desc small { font-size: 13px; color: var(--sub); }
.switch { width: 52px; height: 44px; flex: none; display: flex; align-items: center; }
.switch i { width: 52px; height: 30px; border-radius: 15px; background: #9ca3af; display: flex; align-items: center; padding: 0 3px; }
.switch i::after { content: ''; width: 24px; height: 24px; border-radius: 12px; background: #fff; }
.switch[aria-pressed='true'] i { background: var(--accent); justify-content: flex-end; }
.primary { width: 100%; height: 50px; border-radius: 25px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; margin-top: 16px; }
.secondary { width: 100%; height: 50px; border-radius: 25px; border: 1px solid var(--line); font-size: 16px; font-weight: 500; margin-top: 10px; }
.account-name { font-size: 20px; font-weight: 700; margin: 8px 0 2px; }
.account-sub { font-size: 14px; color: var(--sub); margin: 0 0 12px; }

/* 가입과 로그인 */
.auth { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 28px 32px; }
.logo { width: 64px; height: 64px; border-radius: 16px; background: var(--accent); color: #fff; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.brand { display: flex; flex-direction: column; align-items: center; align-self: flex-start; gap: 6px; }
.maker { font-size: 10px; letter-spacing: 0.04em; color: var(--sub); }
.auth h1 { font-size: 26px; margin: 16px 0 4px; letter-spacing: -0.5px; }
.auth p.lead { margin: 0 0 22px; color: var(--sub); font-size: 15px; }
.auth label { display: block; font-size: 14px; color: var(--sub); margin: 12px 0 6px; }
.auth input { width: 100%; height: 50px; border: 1px solid #d1d5db; border-radius: 12px; padding: 0 14px; font-size: 16px; background: #fff; }
.auth .error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 14px; }
.auth .switch-mode { margin-top: 14px; text-align: center; font-size: 15px; color: var(--sub); }
.auth .switch-mode.forgot { margin-top: 0; }
.auth .switch-mode button { color: var(--accent); font-weight: 600; font-size: 15px; min-height: 44px; padding: 0 6px; }
.auth .error.notice { color: #15803d; }
.auth .hint { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--sub); }

/* 달력과 목록 전환 */
[hidden] { display: none !important; }
.subbar { display: flex; align-items: center; gap: 8px; margin: 0 20px 8px; }
.seg { flex: 1; display: flex; gap: 4px; padding: 3px; background: var(--soft); border-radius: 12px; }
.seg button { flex: 1; height: 38px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--sub); }
.seg button[aria-selected='true'] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.list-wrap.flat { border-top: 0; margin-top: 0; padding-bottom: env(safe-area-inset-bottom); }
.search { padding: 0 16px 8px; }
.search input { width: 100%; height: 44px; border: 1px solid #d1d5db; border-radius: 22px; padding: 0 16px; font-size: 16px; background: #f9fafb; -webkit-appearance: none; appearance: none; }

/* 목록 줄의 부가 정보 */
.title-btn .t { display: block; }
.title-btn .meta { display: block; margin-top: 2px; font-size: 13px; color: var(--sub); text-decoration: none; }
.flag { flex: none; display: flex; margin-right: 8px; }

/* 기간으로 추가 */
.add-range { display: flex; align-items: center; gap: 10px; padding: 8px 12px 0 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--sub); }
.add-range + .add { border-top: 0; }
.add-range input, .field input[type='time'], .field select { height: 40px; border: 1px solid var(--line); border-radius: 20px; padding: 0 14px; font-size: 16px; background: #fff; color: var(--text); }
.icon-btn.on { background: var(--soft); color: var(--accent); }
.text-btn.small { font-size: 14px; color: var(--accent); margin-left: auto; }

/* 상세 시트의 추가 항목 */
.field input[type='date'], .field input[type='time'], .field select { min-width: 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; font-size: 14px; }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.row.sub { min-height: 44px; margin: 0 -11px; }
.row.sub .title-btn { font-size: 15px; padding: 0; min-height: 0; }
.sub-add { display: flex; align-items: center; gap: 8px; }
.sub-add input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 20px; padding: 0 14px; font-size: 16px; background: #fff; }
.sub-add .text-btn { margin-left: 0; }
.field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.5; color: var(--text); resize: vertical; }
.origin { margin: 12px 0 0; font-size: 13px; color: var(--sub); }
.confirm { display: flex; gap: 8px; margin-bottom: 8px; }
.confirm .secondary { margin-top: 0; }
.secondary.danger { color: var(--danger); border-color: #fecaca; }
#monthNav { display: flex; align-items: center; }
.flag { align-items: center; }

/* 공유 달력 */
.cal-chip { height: 44px; max-width: 42%; padding: 0 12px; border: 1px solid var(--line); border-radius: 22px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.cal-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip svg { flex: none; color: var(--sub); }
.sheet-name { font-size: 18px; font-weight: 700; padding: 0 10px; }
.cal-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.cal-pick { flex: 1; min-width: 0; min-height: 56px; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 0; }
.cal-pick b { font-size: 16px; font-weight: 500; }
.cal-pick small { font-size: 13px; color: var(--sub); }
.cal-row.on .cal-pick b { color: var(--accent); font-weight: 700; }
.sub-add.gap { margin-top: 12px; }
.member { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.member span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.member small { color: var(--sub); font-size: 13px; }
.code { margin: 4px 0; font-size: 26px; font-weight: 700; letter-spacing: 3px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.hint { margin: 0 0 4px; font-size: 13px; line-height: 1.5; color: var(--sub); }
.sheet .error { min-height: 20px; margin: 10px 0 0; color: var(--danger); font-size: 14px; }
.cal-tag { margin-left: auto; font-size: 13px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain:disabled { opacity: 0.6; }
.readonly { margin: 4px 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--soft); font-size: 14px; color: var(--sub); }
.primary:disabled { opacity: 0.5; }
.comments { border-bottom: 0; }
.comment { position: relative; padding: 6px 44px 6px 0; }
.comment p { margin: 0; font-size: 14px; }
.comment p small { color: var(--sub); font-size: 12px; margin-left: 4px; }
.comment .body { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment .icon-btn { position: absolute; right: -11px; top: 0; }
.empty.small { padding: 4px 0; font-size: 14px; }

/* 알림과 보기 전용 안내 */
.switch:disabled i { opacity: 0.5; }
.readonly.bar { margin: 8px 16px calc(12px + env(safe-area-inset-bottom)); }

/* 음력, 절기, 공휴일 */
.lbl { height: 13px; max-width: 100%; font-size: 10px; line-height: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; }
.lbl.hol { color: var(--sun); }
.day .bars { margin-top: 2px; }
.day-info { margin: -2px 20px 4px; font-size: 13px; color: var(--sub); }
.cal-tag { margin-left: auto; font-size: 13px; color: var(--sub); white-space: nowrap; }

/* 음력으로 날짜 고르기 */
.cal-tag.link { background: none; border: 0; padding: 6px 0 6px 8px; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.lunar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.lunar-row input[type=number] { width: 84px; }
.lunar-row select, .lunar-row input[type=number] { height: 40px; border: 1px solid var(--line); border-radius: 20px; padding: 0 12px; font-size: 16px; background: #fff; color: var(--text); }
.lunar-row .leap { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--sub); }
.lunar-msg { margin: 0; min-height: 0; font-size: 13px; color: var(--danger); }
.lunar-msg:empty { display: none; }

/* 지난 미완료 한번에 처리 */
.list-head .bulk { margin-left: auto; margin-right: 10px; }

/* 같은 날 목록에서 끌어 순서 바꾸기 */
.grip { flex: none; width: 40px; height: 44px; margin: 0 -8px 0 -4px; display: flex; align-items: center; justify-content: center; color: var(--sub); touch-action: none; cursor: grab; }
.rows .row { transition: transform 0.15s ease; }
.rows .row.dragging { transition: none; position: relative; z-index: 2; background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); border-radius: 10px; }

