/* 개인비서 - 화면 스타일 (밝은 바탕, 검정 글씨, 파랑 강조 하나, 큰 글씨·큰 버튼 유지) */
:root {
  color-scheme: only light;
  --scale: 1;
  --fs-base: calc(16px * var(--scale));
  --fs-small: calc(14px * var(--scale));
  --fs-large: calc(19px * var(--scale));
  --fs-title: calc(20px * var(--scale));
  --fs-hero: calc(27px * var(--scale));
  --tap: 46px;

  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --surface-2: #F7F8FB;
  --hair: rgba(60, 62, 80, 0.12);
  --line: #E9EAF0;
  --text: #1A1C29;
  --muted: #8A8E9E;
  --accent: #7C84E8;
  --accent-dark: #5F68D4;
  --accent-soft: #EEF0FE;
  --danger: #D6455C;
  --danger-soft: #FCEDEF;
  --ok: #3AA47B;
  --ok-soft: #E8F6F0;
  --idea-soft: #FFF4E2;
  --idea-text: #9A6A1E;
  --note-soft: #EEF1F7;
  --note-text: #5A637E;
  --repeat-soft: #F1EDFD;
  --repeat-text: #7159C6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30,34,60,.04), 0 6px 20px rgba(30,34,60,.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: var(--fs-base); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: var(--fs-base); font-weight: 400; line-height: 1.45; letter-spacing: -0.01em;
  word-break: keep-all; overflow-wrap: anywhere; overscroll-behavior-y: contain;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-large); font-weight: 700; }
ul { list-style: none; margin: 0; padding: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid rgba(124,132,232,.5); outline-offset: 2px; border-radius: 8px; }
svg.ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 상단 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 245, 248, .88); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hair);
  display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; min-height: 50px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.brand { font-size: var(--fs-title); font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; letter-spacing: -0.03em; }
.brand img { display: none; }

/* 날짜 + 오늘의 명언 */
.hero { padding: 22px 4px 20px; }
.hero-date { font-size: var(--fs-small); color: var(--muted); font-weight: 500; margin-bottom: 10px; letter-spacing: 0; }
.hero-quote { font-size: var(--fs-hero); font-weight: 800; line-height: 1.32; letter-spacing: -0.035em; color: var(--text); margin: 0; }
.hero-by { font-size: var(--fs-small); color: var(--muted); margin-top: 10px; font-weight: 500; }
.hero-by:empty { display: none; }
.topbar-right { display: flex; gap: 6px; align-items: center; }
.pill { font-size: calc(12.5px * var(--scale)); padding: 4px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.pill.off { background: #ECEDF3; color: var(--muted); }
#btnSettings { min-height: 40px; min-width: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
#btnSettings svg.ico { width: 20px; height: 20px; }
#btnSettings:active { background: var(--surface-2); color: var(--accent-dark); }

.banner { background: #FFF4DB; color: #6B4600; padding: 10px 18px; text-align: center; font-weight: 500; font-size: var(--fs-small); border-bottom: 0.5px solid var(--hair); }

/* 버튼 */
.btn {
  min-height: var(--tap); padding: 9px 16px; border-radius: 12px; border: 0;
  font-weight: 600; font-size: var(--fs-base); display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .08s ease, background .12s ease;
}
.btn:active { transform: scale(.97); background: var(--surface-2); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: none; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.btn-danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 5px 13px; font-size: var(--fs-small); border-radius: 10px; }
.btn-icon { min-width: var(--tap); }

/* 입력 */
input[type=text], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], textarea, select {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border: 0.5px solid var(--hair); border-radius: 12px; background: var(--surface);
  font-size: var(--fs-base); -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8E9E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,132,232,.2); }
textarea { resize: none; line-height: 1.5; }
::placeholder { color: #A9AEC0; opacity: 1; }
label.field { display: block; font-weight: 600; font-size: var(--fs-small); color: var(--muted); margin: 16px 0 6px; text-transform: none; }
.help { color: var(--muted); font-size: var(--fs-small); margin: 6px 0 0; line-height: 1.45; }

/* 화면 */
.view { padding: 12px 16px 24px; max-width: 680px; margin: 0 auto; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 12px; gap: 8px; }
.section-head h2 { font-size: var(--fs-large); font-weight: 800; letter-spacing: -0.03em; }
.count { color: var(--muted); font-size: var(--fs-large); font-weight: 600; margin-left: 2px; }

/* 작은 구분 탭 (오늘 / 전체 / 완료) */
.seg-mini { display: inline-flex; background: #E9EAF0; padding: 3px; border-radius: 10px; gap: 2px; flex: none; }
.seg-mini button { min-height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: calc(13px * var(--scale)); padding: 0 12px; }
.seg-mini button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(30,34,60,.12); }

/* 빠른 입력 */
.capture { background: var(--surface); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.capture-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.capture-label { font-size: var(--fs-small); font-weight: 700; color: var(--muted); letter-spacing: -0.01em; }
.capture-mode { font-size: calc(13px * var(--scale)); font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); padding: 5px 11px; border-radius: 999px; }
.capture textarea { font-size: var(--fs-large); font-weight: 500; min-height: 104px; background: transparent; border-color: transparent; padding: 0 2px; }
.capture textarea::placeholder { color: #B9BDCC; font-weight: 500; }
.capture textarea:focus { background: transparent; border-color: transparent; box-shadow: none; }

/* 종류 직접 고르기 (자동분류 / 할 일 / 아이디어 / 벤치마킹 / 메모) */
.kind-pick { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.kind-pick button {
  min-height: 38px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted); font-weight: 600; font-size: calc(13.5px * var(--scale)); padding: 0 13px;
  display: inline-flex; align-items: center; gap: 5px;
}
.kind-pick button svg.ico { width: 15px; height: 15px; stroke-width: 2; }
.kind-pick button.on { background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px rgba(124,132,232,.4); }

.capture-actions { display: flex; align-items: center; gap: 4px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tool {
  min-height: 40px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: calc(13.5px * var(--scale));
  display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; border-radius: 10px;
}
.tool svg.ico { width: 17px; height: 17px; }
.tool:active { background: var(--surface-2); color: var(--accent-dark); }
.capture-actions .btn-primary { margin-left: auto; min-height: 44px; padding: 0 18px; font-size: var(--fs-base); font-weight: 700; border-radius: 13px; gap: 6px; }
.capture-actions .btn-primary svg.ico { width: 16px; height: 16px; stroke-width: 2.4; }
.capture-status { min-height: 1.3em; margin: 10px 2px 0; font-weight: 500; color: var(--ok); font-size: var(--fs-small); }
.capture-status.err { color: var(--danger); }
.capture-status.busy { color: var(--muted); }

/* 방금 저장한 항목 카드 */
.saved-card { margin-top: 12px; background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); border-left: 4px solid var(--ok); }
.saved-card .saved-title { font-weight: 600; color: var(--ok); font-size: var(--fs-small); margin-bottom: 4px; }
.saved-card .saved-text { font-size: var(--fs-large); font-weight: 600; }
.saved-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.saved-card .kind-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.saved-card .kind-row .lbl { width: 100%; font-size: var(--fs-small); color: var(--muted); }
.due-ask { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--hair); }
.due-ask .lbl { font-weight: 600; margin-bottom: 8px; }
.due-ask .quick-dates { grid-template-columns: repeat(3, 1fr); }

/* 칩 */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 999px; font-size: var(--fs-small); font-weight: 600; min-height: 34px; border: 0; }
.chip.todo { background: var(--ok-soft); color: var(--ok); }
.chip.idea { background: var(--idea-soft); color: var(--idea-text); }
.chip.note { background: var(--note-soft); color: var(--note-text); }
.chip.bench { background: #E4F3EE; color: #10593F; }
button.chip.on.bench { background: #10593F; color: #fff; box-shadow: none; }
.chip.tag { background: #EEEEF2; color: #3C3C43; }
.chip.date { background: var(--accent-soft); color: var(--accent-dark); }
.chip.date.overdue { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.chip.repeat { background: var(--repeat-soft); color: var(--repeat-text); }
button.chip { cursor: pointer; min-height: 46px; padding: 6px 16px; background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 0.5px var(--hair); }
button.chip.on.todo { background: var(--ok); color: #fff; box-shadow: none; }
button.chip.on.idea { background: #B7791F; color: #fff; box-shadow: none; }
button.chip.on.note { background: #3B5486; color: #fff; box-shadow: none; }
button.chip.on.tag { background: var(--text); color: #fff; box-shadow: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 목록 (iOS 그룹 리스트) */
.list { display: flex; flex-direction: column; gap: 0; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.item { background: var(--surface); padding: 12px 12px 12px 14px; display: flex; gap: 12px; align-items: center; position: relative; }
.item + .item::before { content: ""; position: absolute; left: 14px; right: 0; top: 0; height: 0.5px; background: var(--hair); }
.item.overdue .item-text { color: var(--danger); }
.item.done { background: var(--surface-2); }
.item.done .item-text { color: var(--muted); text-decoration: line-through; }
.check {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #B9B9C0; background: #fff; color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; padding: 0; margin: 8px 0 8px 2px;
  position: relative;
}
.check::after { content: ""; position: absolute; inset: -10px; } /* 터치 영역 54px */
.check.on { background: var(--accent); border-color: var(--accent); }
.item-body { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 0; }
.item-text { font-size: var(--fs-base); font-weight: 500; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-meta .chip { min-height: 28px; padding: 1px 9px; font-size: calc(15px * var(--scale)); font-weight: 500; }
.item-more { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #A0A0A8; font-size: 22px; padding: 0; }
.item-more:active { background: var(--surface-2); }
.group-title { font-size: var(--fs-small); font-weight: 600; color: var(--muted); margin: 22px 6px 8px; text-transform: none; }
.group-title.danger { color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 38px 20px; font-size: var(--fs-small); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); line-height: 1.6; }
.empty strong { display: block; font-size: var(--fs-base); color: var(--text); margin-bottom: 6px; font-weight: 700; }
.empty .empty-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: #C6CAD8; }
.empty .empty-ico svg.ico { width: 26px; height: 26px; stroke-width: 2; }

/* 아이디어 카드 */
.card-group { margin-bottom: 20px; }
.card-group h3 { font-size: var(--fs-small); color: var(--muted); font-weight: 600; margin: 0 6px 8px; }

/* 구분 탭 */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; background: #E4E4E9; padding: 3px; border-radius: 12px; margin-bottom: 14px; }
.segmented button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; color: var(--muted); font-size: calc(13px * var(--scale)); padding: 0 4px; white-space: nowrap; }
.segmented button.on { color: var(--text); }
.segmented button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 3px 8px rgba(0,0,0,.06); }

/* 검색/물어보기 */
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; background: #E9E9EE; border-color: transparent; }
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1; }
.ask-result { margin-top: 12px; background: var(--surface); border-radius: 16px; padding: 14px 16px; white-space: pre-wrap; box-shadow: var(--shadow); }
.ask-result .ask-q { color: var(--muted); font-size: var(--fs-small); margin-bottom: 6px; }
.ask-result .list { box-shadow: none; border: 0.5px solid var(--hair); }

/* 요약 카드 */
.summary-card { background: var(--surface); border-radius: 18px; padding: 14px 16px; margin-top: 12px; box-shadow: var(--shadow); }
.summary-card h2 { color: var(--muted); font-size: var(--fs-small); font-weight: 600; margin-bottom: 8px; }
.summary-card ul { padding: 0; }
.summary-card li { margin: 4px 0; font-weight: 500; }

/* 알림 카드 (백업 챙기기 등) */
.nudge-card { background: #FFF8E8; border: 0.5px solid #F0DFB6; border-radius: 18px; padding: 14px 16px; margin-top: 12px; }
.nudge-card .nudge-text { font-weight: 600; margin-bottom: 10px; line-height: 1.5; }
.nudge-card .row { gap: 8px; }
.backup-line { margin-top: 10px; font-size: var(--fs-small); font-weight: 600; color: var(--ok); }
.backup-line.warn { color: #9A6B10; }

/* 다시 볼 것 (되새김) */
.recall-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; }
.recall-why { font-size: var(--fs-small); font-weight: 700; color: var(--accent-dark); margin-bottom: 4px; }
.recall-why.hot { color: var(--danger); }
.recall-text { font-size: var(--fs-base); font-weight: 600; line-height: 1.45; }
.recall-text button { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; width: 100%; }
.recall-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.recall-meta .chip { min-height: 28px; padding: 1px 9px; font-size: calc(15px * var(--scale)); font-weight: 500; }
.recall-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.recall-actions button { min-height: 42px; border-radius: 11px; border: 0; font-size: calc(14px * var(--scale)); font-weight: 700; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 0.5px var(--hair); padding: 0 4px; }
.recall-actions button.go { background: var(--accent); color: #fff; box-shadow: none; }
.recall-actions button.drop { color: var(--danger); }
.recall-open { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; min-height: 40px; padding: 0 14px; border-radius: 11px; border: 0; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: calc(14px * var(--scale)); }

/* 링크 칩 */
.chip.link { background: #E6F0FF; color: #24519E; max-width: 100%; }
.chip.link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.out-done { background: var(--ok-soft); color: var(--ok); }
.chip.out-hold { background: #FFF1DC; color: #9A6B10; }
.chip.out-drop { background: #EEEEF2; color: #6B6B76; }
.chip.push { background: var(--danger-soft); color: var(--danger); }
button.chip.on[data-o] { background: var(--text); color: #fff; box-shadow: none; }

/* 하단 탭 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(249, 249, 251, .9); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--hair);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
}
.tabbar button { border: 0; background: transparent; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #9CA0B0; font-weight: 600; font-size: calc(11.5px * var(--scale)); position: relative; }
.tabbar button svg.ico { width: 22px; height: 22px; stroke-width: 1.9; }
.tabbar button.on { color: var(--accent); font-weight: 600; }
.tabbar .badge { position: absolute; top: 4px; right: calc(50% - 26px); min-width: 20px; height: 20px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* 시트 */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg); border-radius: 20px 20px 0 0; max-height: 92vh; overflow: auto; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  max-width: 680px; margin: 0 auto; box-shadow: 0 -8px 30px rgba(0,0,0,.18);
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: #C7C7CC; margin: 6px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sheet-head h2 { font-size: var(--fs-large); }
.sheet textarea, .sheet input, .sheet select { background: var(--surface); }
.sheet .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.sheet .btn-row .full { grid-column: 1 / -1; }
.quick-dates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.quick-dates button { min-height: 46px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 0.5px var(--hair); border-radius: 11px; font-weight: 600; font-size: var(--fs-small); color: var(--accent); }
.quick-dates button.on { background: var(--accent); color: #fff; box-shadow: none; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.tags-edit { margin-top: 6px; }

/* 토스트 */
.toast {
  position: fixed; left: 16px; right: 16px; top: calc(10px + env(safe-area-inset-top)); z-index: 50;
  background: rgba(28, 28, 30, .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: #fff; border-radius: 16px; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; max-width: 560px; margin: 0 auto; font-size: var(--fs-small);
}
.toast button { background: transparent; color: #6CB4FF; border: 0; border-radius: 10px; min-height: 48px; padding: 6px 12px; font-weight: 700; }

/* 설정 (iOS 그룹) */
.settings-block { background: var(--surface); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.settings-block h2 { font-size: var(--fs-base); font-weight: 700; margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 4px 0; }
.switch input { -webkit-appearance: none; appearance: none; width: 52px; height: 32px; min-height: 0; flex: none; border-radius: 999px; background: #E9E9EA; position: relative; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked { background: #34C759; }
.switch input:checked::after { transform: translateX(20px); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-list .chip.tag { min-height: 46px; padding-right: 0; }
.tag-list .chip.tag button { border: 0; background: transparent; font-size: 18px; color: var(--muted); min-width: 46px; min-height: 46px; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; }
.steps { padding-left: 1.2em; margin: 6px 0; color: var(--muted); font-size: var(--fs-small); }
.steps li { margin: 4px 0; }
details summary { cursor: pointer; font-weight: 600; min-height: 48px; display: flex; align-items: center; color: var(--accent); }
.danger-text { color: var(--danger); font-weight: 600; }
.font-scale-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.font-scale-row button { color: var(--text); }
.font-scale-row button.on { background: var(--accent); color: #fff; box-shadow: none; }
.trash-item { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 0.5px solid var(--hair); }
.trash-item span { flex: 1; }
code { background: #EEEEF2; padding: 2px 6px; border-radius: 6px; font-size: .9em; }

.spinner { display: inline-block; width: 20px; height: 20px; border: 2.5px solid #E5E5EA; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 600px) {
  .capture-actions { grid-template-columns: 1fr 1fr 1fr 2fr; }
  .capture-actions .btn-primary { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Monthly calendar */
.tabbar {grid-template-columns:repeat(5,minmax(0,1fr));}
/* ===== 달력 ===== */
.cal-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-toolbar h2 { flex: 1; font-size: var(--fs-large); margin: 0; white-space: nowrap; }
.cal-toolbar .btn { padding: 8px; min-width: 46px; min-height: 46px; }
#calToday { padding: 8px 14px; }

/* 화면 좌우 여백을 전부 써서 칸을 최대한 넓힘 (칸이 넓어질수록 제목이 한 글자씩 더 보임).
   -16px 는 .view 의 좌우 안쪽 여백과 같은 값이라, 넓은 화면에서도 본문 폭 밖으로 삐져나가지 않음 */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border-radius: 0; overflow: hidden; box-shadow: 0 1px 2px rgba(30,34,60,.05); margin: 0 -16px; }
.cal-weekday { text-align: center; font-size: calc(14px * var(--scale)); font-weight: 600; padding: 10px 0; color: var(--muted); background: var(--surface-2); }
.cal-weekday:first-child { color: #B3261E; }
.cal-weekday:last-child { color: #2366AA; }

.cal-cell {
  display: flex; flex-direction: column; align-items: stretch; gap: 1px; min-width: 0; min-height: 112px;
  padding: 4px 0; border: 0; border-top: 0.5px solid var(--hair); border-left: 0.5px solid var(--hair); background: var(--surface); text-align: left; border-radius: 0; cursor: pointer;
  transition: background .12s ease;
}
/* 일요일 칸은 왼쪽 줄 없음 (달력 맨 왼쪽 가장자리) */
.cal-cell:nth-child(7n + 1) { border-left: 0; }
.cal-muted { opacity: .4; }
.cal-selected { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-number { align-self: center; font-size: calc(13.5px * var(--scale)); font-weight: 700; line-height: 22px; min-width: 22px; text-align: center; margin-bottom: 1px; }
.cal-now { background: var(--accent); color: #fff !important; border-radius: 50%; }
.cal-sat { color: #3B6FD4; }
.cal-sun { color: #D6455C; }
.cal-hol { display: block; font-size: calc(10.5px * var(--scale)); line-height: 14px; color: #D6455C; font-weight: 700; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 1px; }
.cal-more { margin-top: 1px; }
.cal-selected .cal-number { color: var(--accent-dark); }
.cal-selected .cal-number.cal-sun { color: #D6455C; }
.cal-selected .cal-number.cal-sat { color: #3B6FD4; }
.cal-selected .cal-number.cal-now { color: #fff; }

/* 일정 막대: 칸 폭이 50px 남짓이라 한 글자가 아깝다. 좌우 여백을 최소로 두고 글씨는 키움 */
/* 막대는 칸을 꽉 채움. 옆 날짜와 구분은 칸의 세로 줄(.cal-cell border-left)이 해 주므로 좌우 여백이 필요 없음 */
.cal-event { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-radius: 2px; font-size: calc(11.5px * var(--scale)); line-height: 18px; padding: 0 1px; margin: 0; font-weight: 600; letter-spacing: -0.05em; }
/* 일정이 1~2개뿐인 날은 두 줄까지 펼쳐서 제목을 다 보여 줌 */
.cal-wrap2 { white-space: normal; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; }
/* 구글 캘린더에서 가져온 일정 — 보기만 하는 것이라 테두리만 있는 모양으로 구분 */
.cal-event.cal-gcal { background: transparent; color: #4A5568; box-shadow: inset 0 0 0 1px #C3C9D6; font-weight: 500; }
.gcal-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: var(--fs-small); color: var(--muted); }
.gcal-bar .btn { flex: 0 0 auto; }
.cal-color-0 { background: var(--accent-soft); color: var(--accent-dark); }
.cal-color-1 { background: var(--ok-soft); color: var(--ok); }
.cal-color-2 { background: var(--repeat-soft); color: var(--repeat-text); }
.cal-color-3 { background: var(--idea-soft); color: var(--idea-text); }
.cal-done { text-decoration: line-through; opacity: .55; }
.cal-more { font-size: calc(12px * var(--scale)); color: var(--muted); text-align: center; }

/* 날짜를 고르면 달력이 줄고 아래 적는 칸이 위로 올라옴 */
.cal-grid.cal-compact .cal-cell { min-height: 74px; padding: 4px 0; gap: 1px; }
.cal-grid.cal-compact .cal-event { font-size: calc(11px * var(--scale)); line-height: 16px; }
.cal-grid.cal-compact .cal-hol { font-size: calc(10px * var(--scale)); }
.cal-dots { display: none; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: block; }
.cal-dot.d-1 { background: var(--ok); }
.cal-dot.d-2 { background: var(--repeat-text); }
.cal-dot.d-3 { background: #B3261E; }


#calExpand { margin-top: 10px; }

.cal-detail { margin-top: 20px; scroll-margin-top: 76px; }
.cal-detail h2 { font-size: var(--fs-large); margin-bottom: 10px; }
.cal-detail form { background: var(--surface); padding: 16px; border-radius: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.cal-detail form label { display: block; margin-bottom: 8px; font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
.cal-detail .date-row { margin-top: 10px; }
.cal-detail .list { margin-bottom: 4px; }

@media (min-width: 600px) {
  .cal-cell { min-height: 128px; }
  .cal-event { font-size: calc(12.5px * var(--scale)); line-height: 19px; }
  .cal-grid.cal-compact .cal-cell { min-height: 88px; }
}

/* 맨 위로 버튼 (폰에서는 스크롤바가 얇아 잘 안 보이므로) */
.to-top {
  position: fixed; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 35;
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 16px 0 12px;
  border: 0; border-radius: 999px; background: rgba(28, 28, 30, .88); color: #fff; font-weight: 600; font-size: var(--fs-small);
  box-shadow: 0 4px 16px rgba(0,0,0,.28); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.to-top:active { background: rgba(28, 28, 30, 1); transform: scale(.96); }
.to-top svg.ico { width: 20px; height: 20px; stroke-width: 2.2; }

/* ===== 스크롤바 (잘 보이게) ===== */
* { scrollbar-width: thin; scrollbar-color: #8A8A92 rgba(120,120,128,.14); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: rgba(120,120,128,.12); border-radius: 10px; }
::-webkit-scrollbar-thumb { background-color: #8A8A92; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; min-height: 44px; }
::-webkit-scrollbar-thumb:hover { background-color: #5C5C63; background-clip: content-box; }
::-webkit-scrollbar-thumb:active { background-color: var(--accent); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

