/* ============================================================
   투두메이트 디자인 시스템

   방향: 차분하고 정적. 색은 꼭 필요한 곳에만 쓰고, 나머지는 회색 계열과 여백으로 푼다.
   매일 여러 번 여는 앱이라 조용할수록 오래 쓴다.

   기준: 모바일 21:9 (1080×2340), 터치 타깃 최소 44px.
   ============================================================ */

:root {
  color-scheme: light dark;

  /* ── 브랜드 ────────────────────────────────────────────────
     부부의 생활 앱답게 업무용 파랑 대신 따뜻한 테라코타를 주 행동에 쓴다.
     강한 색은 등록·선택·지연처럼 의미가 있는 상태에만 제한한다. */

  /* ── 의미색 ────────────────────────────────────────────── */

  /* ── 표면 ──────────────────────────────────────────────────
     라이트는 바탕을 살짝 눌러 카드(흰색)가 떠 보이게 한다. */
  /* 회색빛 바탕은 화면을 칙칙하게 만든다. 거의 흰색에 가깝게 올리고,
     카드 경계는 배경 대비 대신 아래 --line 이 만든다. */

  /* ── 선 — 카드 경계는 그림자 대신 선으로. 바탕이 밝아진 만큼 선이 경계를 전담한다 ── */

  /* ── 글자 ──────────────────────────────────────────────── */

  /* ── 카테고리 색 8종 ────────────────────────────────────
     categories.js 가 이름에서 0~7 을 뽑아 --cat-N 을 고른다.
     전부 같은 채도대로 맞춰서 한 카테고리만 튀지 않게 한다. */

  /* ── 여백 (4px 스케일) ─────────────────────────────────── */

  /* ── 곡률 ──────────────────────────────────────────────── */

  /* ── 타이포 ─────────────────────────────────────────────
     한 화면에 크기를 3개 넘게 쓰지 않는다. */

  /* ── 그림자 — 떠 있어야 하는 것(입력바·시트·토스트)에만 ── */

  /* ── 모션 — 감속 하나로 통일. 튀는 곡선은 쓰지 않는다 ──── */ /* app.js 가 실측값으로 덮어쓴다 */
}

/* 다크 팔레트.
   아래 두 블록은 내용이 완전히 같다. 시스템이 다크일 때와, 설정에서 '어둡게'로
   고정했을 때를 둘 다 덮어야 하는데 순수 CSS 로는 값 정의를 공유할 수단이 없다.
   (light-dark() 는 구형 크롬에서 글자가 안 보이는 하드 페일이라 안 쓴다.)
   >> 한쪽을 고치면 반드시 다른 쪽도 같이 고칠 것. */

/* ============================================================
   기본
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-lg);
  line-height: 1.5;
  letter-spacing: -0.01em; /* 한글은 살짝 좁혀야 덩어리로 읽힌다 */
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.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;
}

.view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.loading-text {
  margin: auto;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   버튼
   ============================================================ */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 0 var(--s5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
    opacity var(--fast) var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:active {
  background: var(--accent-hover);
}

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

.btn-secondary:active {
  background: var(--surface-2);
}

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

.btn-ghost:active {
  background: var(--surface-3);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:active {
  background: var(--danger-weak);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ============================================================
   로그인 / 온보딩
   ============================================================ */
.login-card,
.onboarding-card {
  margin: auto;
  padding: var(--s6);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-size: var(--fs-2xl);
  margin: 0 auto var(--s5);
}

.login-card h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--s2);
  letter-spacing: -0.03em;
}

.onboarding-card h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--s2);
  letter-spacing: -0.02em;
}

.login-card p,
.onboarding-card p {
  color: var(--text-2);
  margin: 0 0 var(--s6);
  font-size: var(--fs-sm);
}

.onboarding-card {
  text-align: left;
}

.onboarding-card h2,
.onboarding-card > p {
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: var(--s5) 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.field {
  width: 100%;
  min-height: 50px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0 var(--s4);
  font-size: var(--fs-lg);
  margin-bottom: var(--s3);
  transition: border-color var(--fast) var(--ease);
}

.field:focus {
  border-color: var(--accent);
  outline: none;
}

#input-invite-code {
  text-align: center;
  letter-spacing: 0.25em;
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
}

.error-text {
  color: var(--danger);
  font-size: var(--fs-sm);
  margin-top: var(--s3);
  text-align: center;
}

.btn-install {
  margin-top: var(--s3);
}

/* ============================================================
   헤더 + 탭
   ============================================================ */
#view-app {
  /* 하단 입력바를 피해 목록 마지막 줄이 가리지 않게 한다. */
  padding-bottom: calc(var(--composer-h) + 60px + var(--s5));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: var(--s4) var(--s4) 0;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
}

.header-date {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
}

.header-summary {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  margin-top: 2px;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  gap: var(--s1);
  flex: 0 0 auto;
}

.icon-btn {
  width: 44px;
  height: 44px;
  margin: -6px -8px 0 0; /* 시각적 정렬은 유지하고 히트 영역만 넓힌다 */
  border-radius: var(--r-pill);
  border: none;
  background: transparent;
  color: var(--text-2);
  display: grid;
  place-items: center;
  position: relative;
  transition: background var(--fast) var(--ease);
}

.icon-btn:active {
  background: var(--surface-3);
}

.icon-btn svg {
  display: block;
}

.icon-btn[data-badge]::after {
  content: '';
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--danger);
  border: 2px solid var(--bg);
}

/* 탭 — 밑줄 대신 알약형 세그먼트. 밑줄은 폭이 제각각이라 정렬이 흐트러진다. */
.tabs {
  display: flex;
  gap: 2px;
  margin: var(--s4) 0 var(--s2);
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.tab-btn {
  flex: 1;
  min-height: 40px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r-md) - 3px);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.tab-btn[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

.tab-count {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.tab-btn[aria-selected='true'] .tab-count {
  color: var(--accent);
}

/* 0 은 정보가 없다 — 굳이 자리를 차지할 이유가 없다 */
.tab-count:empty,
.tab-count[data-zero='true'] {
  display: none;
}

/* ============================================================
   상대 변경 배너
   ============================================================ */
.changes-banner {
  margin: var(--s2) var(--s4) 0;
  padding: var(--s3) var(--s4);
  background: var(--accent-weak);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.changes-banner button {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  padding: var(--s2);
  min-height: 44px;
  flex: 0 0 auto;
}

/* ============================================================
   목록
   ============================================================ */
.list {
  padding: 0 var(--s4) var(--s6);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  padding: var(--s5) var(--s1) var(--s2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.section-header.danger {
  color: var(--danger);
}

/* 루틴은 "오늘 또 돌아온 일". 한시적 할 일과 성격이 달라 색으로 구역을 구분한다. */
.section-header.routine {
  color: var(--cat-7);
}

.section-header.routine svg {
  display: block;
  flex: 0 0 auto;
}

/* 루틴 판은 왼쪽에 띠를 둘러 스크롤 중에도 구역이 바뀐 걸 알 수 있게 한다.
   판이 overflow:hidden 이라 inset 그림자는 잘려서 안 보인다 — 테두리로 그린다. */
.panel-routine {
  border-left: 3px solid var(--cat-7);
}

.section-count {
  font-weight: var(--fw-bold);
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

.empty-section {
  text-align: center;
  color: var(--text-3);
  padding: var(--s5) var(--s4);
  font-size: var(--fs-sm);
}

/* 빈 화면은 절제한다 — "할 일이 없다"보다 아래 입력창이 눈에 들어와야 한다 */
.empty-state {
  text-align: center;
  padding: var(--s10) var(--s6);
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.empty-icon {
  display: block;
  margin: 0 auto var(--s3);
  color: var(--text-3);
  opacity: 0.7;
}

.empty-sub {
  margin-top: var(--s1);
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ── 목록 판 ────────────────────────────────────────────
   항목마다 테두리 박스를 치면 선이 줄마다 반복돼 시끄럽다.
   섹션 전체를 흰 판 하나로 묶고 안에서 얇은 선으로만 나눈다. */
.panel {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden; /* 첫/마지막 행이 판의 둥근 모서리를 넘지 않게 */
  /* 바탕이 거의 흰색이라 명도 대비만으로는 판이 안 떠 보인다 — 아주 옅은 그림자로 띄운다 */
  box-shadow: 0 1px 2px rgba(16, 22, 38, 0.06), 0 0 0 1px rgba(16, 22, 38, 0.04);
}

/* ── 할 일 행 ───────────────────────────────────────────── */
.todo-swipe {
  position: relative;
  overflow: hidden;
  background: var(--danger);
}

/* 판 안에서는 행 사이만 선으로 나눈다. 마지막 행 아래 선은 판 경계와 겹쳐 지저분하다. */
.panel .todo-swipe + .todo-swipe .todo-row {
  border-top: 1px solid var(--line);
}

/* ::after 는 DOM 상 마지막 자식이라 z-index 없이는 카드 '위'에 그려진다.
   그러면 밀지도 않았는데 '삭제'가 항상 보인다. 반드시 카드보다 아래로. */
.todo-swipe::after {
  content: '삭제';
  position: absolute;
  z-index: 0;
  top: 0;
  right: var(--s5);
  height: 100%;
  display: flex;
  align-items: center;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.todo-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  min-height: 60px;
  background: var(--surface);
  border: none;
  touch-action: pan-y;
  transition: transform var(--base) var(--ease), opacity var(--base) var(--ease);
}

.todo-row.swiping {
  transition: none;
}

/* 완료 행은 배경까지 가라앉혀 남은 할 일보다 뒤로 물러나 보이게 한다 */
.todo-row.completed {
  background: var(--surface-2);
}

/* 우선순위는 좌측 얇은 바 하나로만. 행 전체를 물들이면 목록이 시끄럽다 */
.todo-row.priority::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--danger);
}

.todo-row.leaving {
  opacity: 0;
  transform: translateX(-100%);
}

.checkbox {
  position: relative;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  flex: 0 0 auto;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: transparent;
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  line-height: 1;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

/* 보이는 크기는 22px 로 두고 히트 영역만 44px 로 넓힌다 */
.checkbox::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.checkbox:active {
  border-color: var(--accent);
}

.checkbox.checked {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

/* 끝난 일이 남은 일보다 눈에 띄면 안 된다 */
.todo-row.completed .checkbox.checked {
  opacity: 0.4;
}

.todo-main {
  flex: 1;
  min-width: 0;
}

.todo-title {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  font-size: var(--fs-lg);
  font-weight: var(--fw-regular);
  color: var(--text);
  word-break: break-word;
  line-height: 1.45;
}

.todo-row.completed .todo-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
  color: var(--text-3);
  font-weight: var(--fw-regular);
}

.todo-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s1);
}

.meta {
  font-size: var(--fs-xs);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.meta.overdue {
  color: var(--danger);
  font-weight: var(--fw-bold);
}

.meta.soon {
  color: var(--warn);
  font-weight: var(--fw-bold);
}

/* 태그는 배경을 깔지 않고 점 하나로 구분한다 — 알약이 줄마다 붙으면 시끄럽다 */
.tag {
  position: relative;
  border: none;
  background: none;
  padding: 0 0 0 10px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.6;
}

.tag::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: var(--r-pill);
  background: currentColor;
  transform: translateY(-50%);
  opacity: 0.7;
}

/* 카테고리 — 아이콘 + 이름, 카테고리 고유색(--tone 은 JS 가 넣는다).
   색과 아이콘이 함께 있어야 한눈에 구분된다. 색만으로는 색약인 사람이 못 읽는다. */
.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--tone, var(--text-3));
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  line-height: 1.6;
}

.cat-tag svg {
  display: block;
  flex: 0 0 auto;
}

/* ── 콜 (상대 찌르기) ──────────────────────────────────────
   무료 요금제라 서버 푸시가 없다. 상대가 앱을 열면 보이는 표시가 전부라
   행에서 눈에 띄어야 의미가 있다. */
.poke-btn {
  flex: 0 0 auto;
  width: 40px;
  min-height: 40px;
  margin: -2px -4px 0 0;
  padding: 0 var(--s2);
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.poke-btn:active {
  background: var(--surface-2);
}

.poke-btn svg {
  display: block;
}

/* 이미 보낸 콜은 색으로만 알린다 — 여러 번 눌러 재촉하는 것 자체는 막지 않는다 */
.poke-sent {
  color: var(--warn);
}

.poke-ack {
  width: auto;
  color: var(--accent);
  background: var(--accent-weak);
}

/* 내가 콜 받은 항목 */
.todo-row.poked {
  background: var(--warn-weak);
}

.poke-badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--warn);
}

.tag.assignee-me {
  color: var(--accent);
  font-weight: var(--fw-bold);
}

.tag.assignee-partner {
  color: var(--warn);
  font-weight: var(--fw-bold);
}

/* ============================================================
   주간 스트립 (예정 탭)
   어느 날에 일이 몰려 있는지 한눈에 보는 것이 목적. 개수는 점으로만 표시한다 —
   14칸에 숫자를 넣으면 빽빽해서 오히려 안 읽힌다.
   ============================================================ */
.week-strip {
  display: flex;
  gap: var(--s1);
  overflow-x: auto;
  padding: var(--s3) var(--s4) var(--s2);
  scrollbar-width: none;
}

.week-strip::-webkit-scrollbar {
  display: none;
}

.day {
  flex: 0 0 auto;
  width: 46px;
  min-height: 62px;
  padding: var(--s2) 0 var(--s1);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.day-name {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-weight: var(--fw-bold);
}

.day-num {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.day-dots {
  display: flex;
  gap: 2px;
  height: 5px;
  align-items: center;
}

.day-dots i {
  width: 4px;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.day-empty {
  background: transparent;
}

.day-empty .day-num {
  color: var(--text-3);
  font-weight: var(--fw-regular);
}

/* 오늘은 테두리로만 표시 — 선택과 헷갈리지 않게 채우지는 않는다 */
.day-today {
  border-color: var(--line-strong);
}

.day-selected {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.day-selected .day-name,
.day-selected .day-num {
  color: var(--bg);
}

.day-selected .day-dots i {
  background: var(--bg);
}

/* ============================================================
   검색 / 필터 / 토글
   ============================================================ */
.search-row {
  padding: var(--s2) var(--s4) 0;
}

.search-input {
  width: 100%;
  min-height: 44px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 0 var(--s4);
  font-size: var(--fs-sm);
}

.search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
}

.chips {
  display: flex;
  overflow-x: auto;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 var(--s4);
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}

/* 아이콘이 들어가는 카테고리 칩 */
.chip-cat {
  gap: 5px;
  color: var(--tone, var(--text-2));
  border-color: color-mix(in srgb, var(--tone, var(--line-strong)) 40%, transparent);
}

.chip svg {
  display: block;
  flex: 0 0 auto;
}

.chip-selected {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-weight: var(--fw-bold);
}

/* 선택된 카테고리 칩은 그 카테고리 색으로 채운다 — 지금 뭘 보고 있는지가 색으로 남는다 */
.chip-cat.chip-selected {
  background: var(--tone);
  border-color: var(--tone);
  color: #fff;
}

.chip-delete {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 19px;
  height: 19px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
  background: var(--danger);
  /* 다크의 --danger 는 밝은 살구색이라 흰 ×가 1.9:1 로 묻혔다. 바탕색으로 쓰면 두 테마 모두 4.5:1 을 넘는다. */
  color: var(--bg);
  font-size: var(--fs-xs);
}

.chip-add {
  border-style: dashed;
  color: var(--text-3);
}

/* 장보기 "다시 담기" — 여러 줄로 감싸서 한 번에 훑어보게 한다 (가로 스크롤이면 뒤가 안 보인다) */
.quick-add {
  flex-wrap: wrap;
  overflow-x: visible;
  padding-top: 0;
}

.quick-add .chip {
  max-width: 100%;
  overflow: hidden;
}

.quick-add .chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s4) var(--s2);
  font-size: var(--fs-sm);
  color: var(--text-2);
  min-height: 44px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ============================================================
   하단 입력바 — 가장 자주 쓰는 동작이라 엄지가 닿는 곳에 고정
   ============================================================ */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  box-shadow: var(--shadow-up);
  padding: var(--s3) var(--s3) calc(var(--s3) + var(--safe-b));
}

.composer-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.composer-input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 0 var(--s4);
  font-size: var(--fs-lg); /* 16px 미만이면 포커스 시 화면이 확대된다 */
}

.composer-input::placeholder {
  color: var(--text-3);
}

.composer-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
}

.composer-btn {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

.composer-btn:active {
  background: var(--surface-3);
  transform: scale(0.94);
}

/* 음성 버튼은 입력창 안의 보조 동작으로 둔다. 텍스트와 음성의 진입점을
   같은 곳에 두면 처음 쓰는 사람도 어느 버튼을 눌러야 할지 바로 이해한다. */
.voice-btn {
  color: var(--text-2);
}

.voice-btn.listening {
  background: var(--danger-weak);
  color: var(--danger);
  animation: mic-pulse 1.6s var(--ease) infinite;
}

/* ── 음성 예시 말풍선 ──────────────────────────────────────
   "말하면 알아서 등록된다"는 걸 모르면 제목만 말하게 되고, 이 앱의 절반을 못 쓴다. */
.voice-hint {
  position: fixed;
  right: calc(var(--s4) + 60px + var(--s2));
  bottom: calc(var(--composer-h) + var(--s3) + 8px);
  z-index: 21;
  max-width: calc(100vw - 120px);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: hint-in 220ms var(--ease);
}

/* 말풍선 꼬리 — 마이크 쪽을 가리킨다 */
.voice-hint::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: 16px;
  width: 10px;
  height: 10px;
  background: var(--text);
  transform: rotate(45deg);
  border-radius: var(--r-xs);
}

.voice-hint-label {
  font-size: var(--fs-xs);
  opacity: 0.65;
  font-weight: var(--fw-bold);
}

.voice-hint-sample {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes hint-in {
  from {
    opacity: 0;
    transform: translateX(6px);
  }
}

.composer-btn svg {
  display: block;
}

.composer-btn.send {
  background: var(--accent);
  color: var(--on-accent);
}

.composer-btn.send:active {
  background: var(--accent-hover);
}

/* 보낼 내용이 없으면 눌러도 아무 일이 없다 — 눌러도 되는 것처럼 보이지 않게 */
.composer-btn.send.is-empty {
  background: var(--surface-2);
  color: var(--text-3);
}

.composer-btn:disabled {
  opacity: 0.4;
}

@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(194, 69, 63, 0.45);
  }
  60% {
    box-shadow: 0 0 0 12px rgba(194, 69, 63, 0);
  }
}

/* 파싱 결과 미리보기 — 등록 전에 "어떻게 알아들었는지" 보여준다 */
.parse-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: 0 var(--s2) var(--s3);
}

.parse-preview:empty {
  display: none;
}

.parse-preview .tag {
  padding: 3px var(--s3);
  border-radius: var(--r-pill);
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
}

.parse-preview .tag::before {
  display: none;
}

/* ============================================================
   토스트
   ============================================================ */
.toast {
  position: fixed;
  left: var(--s3);
  right: var(--s3);
  bottom: calc(var(--composer-h) + var(--s5));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-2);
  animation: toast-in var(--base) var(--ease);
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 var(--s3);
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--accent);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  display: inline-flex;
  align-items: center;
}

.toast-action:active {
  background: rgba(255, 255, 255, 0.12);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ============================================================
   바텀시트
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 12, 16, 0.5);
  animation: fade-in var(--base) var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  max-height: 88dvh;
  overflow-y: auto;
  padding: var(--s2) var(--s5) calc(var(--s6) + var(--safe-b));
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: sheet-up 260ms var(--ease);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

.sheet-grip {
  width: 36px;
  height: 4px;
  margin: var(--s2) auto var(--s5);
  border-radius: var(--r-pill);
  background: var(--line-strong);
}

.sheet h2 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin: 0 0 var(--s5);
}

.sheet-section {
  margin-bottom: var(--s5);
}

.sheet-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-bottom: var(--s2);
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 52px;
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
}

.sheet-row:last-child {
  border-bottom: none;
}

.sheet-row .label {
  font-size: var(--fs-lg);
}

.sheet-row .value {
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: right;
}

/* 시트 안에서 값을 바꾸는 작은 버튼 */
.sheet-row .tag {
  padding: 0 var(--s3);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.sheet-row .tag::before {
  display: none;
}

.invite-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4);
  background: var(--accent-weak);
  border-radius: var(--r-md);
}

.invite-code-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: 0.22em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.paired-badge {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--ok-weak);
  color: var(--ok);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-top: var(--s4);
}

.segment {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.segment button {
  flex: 1;
  min-height: 42px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r-md) - 3px);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-3);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.segment button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

.hint {
  margin-top: var(--s2);
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.6;
}

.help-list {
  margin: 0;
  padding-left: var(--s5);
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.help-list li {
  margin-bottom: var(--s2);
}

.help-list code {
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  font-family: inherit;
  color: var(--text);
}

/* ============================================================
   사용성 리디자인 레이어

   기능은 그대로 두고, 매일 쓰는 흐름의 시선·손가락 이동을 줄인다.
   탭/태그의 반복되는 알약 배경은 줄이고 제목·마감·담당자를 먼저 읽게 한다.
   ============================================================ */

#view-app {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: calc(var(--composer-h) + var(--s5));
}

.login-card,
.onboarding-card {
  max-width: 440px;
  padding: var(--s8) var(--s6);
}

.brand-mark {
  width: 68px;
  height: 68px;
  border-radius: var(--r-lg);
  background: var(--accent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.login-card h1 {
  font-size: var(--fs-2xl);
  letter-spacing: -0.045em;
}

.login-card p,
.onboarding-card p {
  font-size: var(--fs-lg);
  line-height: 1.55;
}

.login-card .login-note {
  margin-top: -12px;
  margin-bottom: var(--s5);
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.65;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  min-height: 48px;
  border-radius: var(--r-md);
}

.app-header {
  padding: var(--s5) 20px 0;
}

.header-date {
  font-size: var(--fs-sm);
  letter-spacing: 0;
}

.header-summary {
  font-size: var(--fs-2xl);
  letter-spacing: -0.04em;
}

.tabs {
  gap: 0;
  margin: var(--s5) 0 0;
  padding: 0;
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.tab-btn,
.tab-btn[aria-selected='true'] {
  position: relative;
  min-height: 46px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-3);
  font-size: var(--fs-lg);
}

.tab-btn[aria-selected='true'] {
  color: var(--accent);
}

.tab-btn[aria-selected='true']::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -1px;
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.tab-count {
  min-width: 20px;
  min-height: 20px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-btn[aria-selected='true'] .tab-count {
  background: var(--accent-weak);
  color: var(--accent);
}

.changes-banner {
  margin: var(--s3) 20px 0;
  background: var(--shared-weak);
  border: 1px solid color-mix(in srgb, var(--shared) 18%, transparent);
  color: var(--text);
}

.list {
  padding: 0 20px var(--s6);
}

.section-header {
  padding: 24px 2px 10px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  letter-spacing: -0.01em;
}

.section-header.danger {
  color: var(--danger);
}

.section-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  text-align: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 2px 8px rgba(40, 34, 30, 0.045);
}

.todo-row {
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 14px 16px;
}

.todo-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-regular);
  line-height: 1.42;
}

.todo-meta-row {
  gap: 8px;
  margin-top: 4px;
}

.meta,
.cat-tag,
.tag {
  font-size: var(--fs-xs);
}

.meta {
  line-height: 1.5;
}

.todo-side {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  margin-left: 4px;
}

.assignee-btn {
  width: auto;
  min-width: 28px;
  min-height: 32px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

.assignee-btn.assignee-both {
  color: var(--shared);
  background: var(--shared-weak);
}

.assignee-btn.assignee-me {
  color: var(--accent);
  background: var(--accent-weak);
}

.assignee-btn.assignee-partner {
  color: var(--warn);
  background: var(--warn-weak);
}

.assignee-btn:active,
.todo-link:active {
  transform: scale(0.94);
}

.todo-link {
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--accent);
  background: var(--accent-weak);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  max-width: 170px;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}

.todo-link svg {
  display: block;
  flex: 0 0 auto;
}

.todo-link-label {
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.todo-row.completed .todo-link,
.todo-row.completed .assignee-btn {
  opacity: 0.55;
}

.todo-row.poked {
  background: var(--warn-weak);
}

.week-strip {
  gap: 6px;
  padding: 14px 20px 8px;
}

.day {
  width: 48px;
  min-height: 66px;
  border-radius: var(--r-md);
  background: var(--surface);
  border-color: var(--line);
}

.day-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.day-selected .day-name,
.day-selected .day-num,
.day-selected .day-dots i {
  color: var(--on-accent);
  background-color: var(--on-accent);
}

.chips {
  gap: 8px;
  padding: 12px 20px;
}

.chip {
  min-height: 36px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}

.chip-selected {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.chip-cat.chip-selected {
  background: var(--tone);
  border-color: var(--tone);
  color: #fff;
}

.search-row {
  padding: 14px 20px 0;
}

.search-input {
  min-height: 46px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.toggle-row {
  min-height: 44px;
  padding: 4px 20px 8px;
}

.composer {
  left: 50%;
  right: auto;
  width: min(100%, 720px);
  transform: translateX(-50%);
  padding: 10px 16px calc(10px + var(--safe-b));
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(40, 34, 30, 0.07);
}

.composer-row {
  gap: 8px;
}

.composer-input {
  min-height: 48px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.composer-btn {
  width: 46px;
  height: 46px;
}

.voice-btn {
  color: var(--text-2);
}

.voice-btn.listening {
  background: var(--danger-weak);
  color: var(--danger);
  animation: mic-pulse-soft 1.6s var(--ease) infinite;
}

.voice-hint {
  right: 16px;
  bottom: calc(var(--composer-h) + 12px);
  max-width: min(310px, calc(100vw - 32px));
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--bg);
}

.parse-preview {
  padding: 0 0 8px;
}

.parse-preview .tag {
  padding: 5px 9px;
  border-radius: var(--r-sm);
  background: var(--accent-weak);
  color: var(--accent);
}

.sheet {
  max-width: 720px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.sheet h2 {
  font-size: var(--fs-lg);
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-2xl);
  line-height: 1;
  display: grid;
  place-items: center;
}

.sheet-close:active {
  background: var(--surface-2);
}

.sheet-label {
  font-size: var(--fs-sm);
  color: var(--text-2);
  letter-spacing: 0;
}

@keyframes mic-pulse-soft {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 30%, transparent);
  }
  60% {
    box-shadow: 0 0 0 8px transparent;
  }
}

@media (min-width: 600px) {
  .app-header {
    padding-left: 0;
    padding-right: 0;
  }

  .list {
    padding-left: 0;
    padding-right: 0;
  }

  .changes-banner {
    margin-left: 0;
    margin-right: 0;
  }

  .week-strip,
  .chips,
  .search-row {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 359px) {
  .app-header {
    padding-left: 16px;
    padding-right: 16px;
  }

  .list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .todo-row {
    padding-left: 12px;
    padding-right: 12px;
  }

  .todo-side {
    margin-left: 0;
  }

  .assignee-btn {
    min-width: 26px;
    padding-left: 5px;
    padding-right: 5px;
  }

  .todo-link-label {
    display: none;
  }

  .todo-link {
    width: 30px;
    padding: 0;
  }
}

/* ── 이번 주 요약 ──────────────────────────────────────────
   목록 맨 아래에 조용히 놓는 격려 한 줄. 경쟁이 아니라 합계가 주인공이라
   총합만 진하게 두고 각자 몫은 작게 흐린다. */
.week-summary {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin: var(--s5) 0 var(--s3);
  padding: var(--s3);
  border-top: 1px solid var(--line);
  color: var(--text-3);
}

.week-summary-total {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-2);
}

.week-summary-split {
  font-size: var(--fs-xs);
}

/* ── 순서 바꾸기 (길게 눌러 드래그) ────────────────────────
   드래그 중인 행은 손가락을 따라 움직이므로 transition 을 끈다 —
   안 끄면 손가락보다 늦게 따라와 '무겁다'는 느낌이 난다. */
.todo-swipe.dragging {
  position: relative;
  z-index: 5;
  transition: none;
  box-shadow: var(--shadow-2);
  opacity: 0.95;
}

.todo-swipe.dragging .todo-row {
  background: var(--surface-3);
}

/* 드래그 중에는 나머지 행이 자리를 비켜주는 것이 보여야 한다. */
.panel.reordering .todo-swipe:not(.dragging) {
  transition: transform var(--fast) var(--ease);
}

/* ── 카테고리 인라인 추가 ─────────────────────────────────── */
.cat-add-row {
  display: flex;
  gap: var(--s2);
  width: 100%;
  align-items: center;
}

.cat-add-row .field {
  flex: 1;
  min-width: 0;
}

.chip-add {
  font-weight: var(--fw-bold);
  min-width: 44px;
  justify-content: center;
}

/* ── 사진 ─────────────────────────────────────────────────── */
.photo-box {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}

.photo-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  cursor: zoom-in;
}

/* 사진 원본 비율을 지키면서 화면 안에 다 들어오게. 배경은 확실히 어둡게 깔아
   밝은 사진이든 어두운 사진이든 경계가 보이게 한다. */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}

.photo-viewer img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-md);
}

/* ── '내 할 일' 필터 칩 ────────────────────────────────────
   카테고리 칩과 성격이 다른 토글이라(색이 아니라 켜짐/꺼짐) 살짝 구분되게 둔다. */
.chip-mine {
  font-weight: var(--fw-bold);
}

.chip-mine[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ── 사진 표시 (목록 행) ──────────────────────────────────── */
.meta-photo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── 개인 할 일 행 구분선 ─────────────────────────────────
   공유 목록 행은 .todo-swipe 로 감싸여 있어서 그쪽 규칙으로 선이 그어지는데,
   개인 행은 스와이프가 없어 감싸개도 없다. 여기서 따로 그어준다. */
.panel .personal-row + .personal-row {
  border-top: 1px solid var(--line);
}

/* ── 공용 / 개인 모드 전환 ────────────────────────────────
   탭(오늘·예정·전체·완료)보다 위에 두고 생김새도 다르게 한다. 둘은 층위가 다르다 —
   이건 '어떤 목록을 볼지', 탭은 '그 목록의 어느 부분을 볼지'다.
   같은 모양으로 두면 탭이 8개인 것처럼 보여서 매번 헷갈린다. */
.scope-switch {
  display: flex;
  gap: 2px;
  margin: var(--s3) 0 var(--s2);
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.scope-btn {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  border-radius: calc(var(--r-md) - 3px);
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.scope-btn[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

/* ── 상단 밀도 정리 ────────────────────────────────────────
   모드 전환이 생기면서 머리말이 헤더·모드·탭·칩 4단이 됐다. 실측해 보니 첫 할 일이
   나오기까지 256px — 21:9 화면(812pt)의 31%를 목록이 아닌 것이 쓰고 있었다.
   각 단의 여백을 줄여 목록을 위로 끌어올린다. 단, 터치 타깃 44px 은 유지한다. */
.scope-switch {
  margin: var(--s2) 0 var(--s2);
}

.scope-btn {
  padding: 7px 10px;
}

/* 모드와 탭 사이가 28px(8+20)이나 벌어져 두 줄이 따로 노는 것처럼 보였다. */
.tabs {
  margin-top: var(--s2);
}

#today-chips,
#upcoming-chips,
#all-chips {
  padding-top: var(--s2);
  padding-bottom: var(--s2);
}

/* 첫 구역 제목의 윗여백은 칩과 붙지 않을 만큼만 남긴다. */
.list > .section-header:first-child {
  padding-top: var(--s3);
}

/* 이번 주 요약만 가운데 정렬이라 목록 전체의 왼쪽 축에서 혼자 튀었다. */
.week-summary {
  justify-content: flex-start;
  margin-top: var(--s4);
}

/* ── 편집 시트: 첨부(링크·사진) ───────────────────────────
   둘 다 대부분의 할 일에는 없다. 항상 펼쳐 두면 빈 입력칸 두 개가 시트의 17%를 먹고
   자주 쓰는 날짜·담당자를 화면 밖으로 밀어낸다. 없을 때는 버튼 한 줄로만 둔다. */
.attach-row {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

.attach-row:empty {
  display: none;
}

.attach-field {
  margin-top: var(--s3);
}

.attach-field .sheet-label {
  margin-bottom: var(--s2);
}

/* ── 인라인 액션 버튼 ──────────────────────────────────────
   .tag 는 원래 '점 + 작은 글씨'인 메타 라벨 스타일인데, 복사·켜기·반복 해제 같은
   실제 버튼에도 그대로 쓰이고 있었다. 실측 높이 19px — 눌러지는 것처럼 보이지도 않고
   터치 타깃 최소 44px 에도 한참 못 미쳤다. 버튼은 버튼처럼 보이게 따로 둔다. */
.btn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

/* 보이는 크기는 36px 로 두되, 실제로 눌리는 영역은 44px 을 채운다.
   버튼을 더 키우면 옆 글자와 부딪혀 목록이 시끄러워진다. */
.btn-chip::after {
  content: '';
  position: absolute;
  inset: -4px;
}

.btn-chip {
  position: relative;
}

.btn-chip:active {
  background: var(--surface-3);
  border-color: var(--accent);
}

/* ── 담당자 표시 (목록 행) ────────────────────────────────
   버튼이 아니라 표시로 바뀌었다. 행에서 담당자를 바꾸는 버튼은 스와이프 삭제·롱프레스
   드래그와 같은 자리를 놓고 다퉈서 셋 다 오작동했고, 훑어보다 잘못 눌러 담당자가
   바뀌는 일도 있었다. 바꾸는 것은 편집 팝업에서만 한다. */
.assignee-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

.assignee-tag.assignee-both {
  color: var(--shared);
  background: var(--shared-weak);
}

.assignee-tag.assignee-me {
  color: var(--accent);
  background: var(--accent-weak);
}

.assignee-tag.assignee-partner {
  color: var(--warn);
  background: var(--warn-weak);
}

/* ── 편집 팝업: 한눈에 들어오게 ────────────────────────────
   섹션마다 20px 씩 띄우니 필드 7개가 세로로 길게 늘어져 전체가 한 번에 안 읽혔다.
   간격을 줄이고, 라벨과 입력을 한 덩어리로 묶어 시선이 위아래로 튀지 않게 한다. */
.sheet-section {
  margin-bottom: var(--s4);
}

.sheet-label {
  margin-bottom: var(--s2);
}

/* 날짜·시간은 성격이 같아 나란히 두면 두 줄이 한 줄로 줄고 관계도 분명해진다. */
.sheet-duo {
  display: flex;
  gap: var(--s3);
}

.sheet-duo > * {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

/* ── 댓글 ─────────────────────────────────────────────────
   대화라서 말풍선처럼 뭉치지 않고, 누가·언제·무슨 말인지 세 줄로 담백하게 쌓는다.
   둘이서 쓰는 목록이라 좌우로 나눌 만큼 말이 오가지 않는다. */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.comment {
  padding: var(--s3);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.comment-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: 2px;
}

.comment-who {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-2);
}

.comment-when {
  flex: 1;
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.comment-del {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-3);
  font-size: var(--fs-lg);
  line-height: 1;
  cursor: pointer;
}

.comment-del:active {
  background: var(--surface-3);
}

.comment-text {
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-add {
  display: flex;
  gap: var(--s2);
}

.comment-add .field {
  flex: 1;
  min-width: 0;
}

/* 초대 카드(invite.js) — 홈 오늘 칸·연결 상태 시트 */
.invite-card {
  display: grid;
  gap: var(--s3);
  margin: var(--s3) 0;
  padding: var(--s4);
  border: 1px solid var(--accent-weak);
  border-radius: var(--r-md);
  background: var(--surface);
}
.invite-card-text {
  display: grid;
  gap: var(--s1);
}
.invite-card-text strong {
  font-size: var(--fs-md);
}
.invite-card-text span {
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.invite-card.compact .invite-code-box {
  padding: var(--s2) var(--s3);
}
.invite-card.compact .invite-code-value {
  font-size: var(--fs-xl);
}

/* 완료 순간 반응(checkHold.js) — 체크가 톡 차오르고 제목에 줄이 그어진 뒤 목록에서 빠진다. 누른 게 들어갔는지 눈으로 알게. */
.todo-swipe.completing .checkbox::before,.schedule-task.completing .schedule-check:before{animation:check-pop var(--check-hold) var(--ease)}
.todo-swipe.completing .todo-title,.schedule-task.completing .schedule-task-body strong{text-decoration:line-through;color:var(--text-3);transition:color var(--base) var(--ease)}
/* 저장 중 잠금(disabled)이 체크를 흐리게 만들면 반응이 안 보인다 */
.todo-swipe.completing .checkbox:disabled,.schedule-task.completing .schedule-check:disabled{opacity:1}
@keyframes check-pop{0%{transform:scale(.7)}55%{transform:scale(1.18)}100%{transform:scale(1)}}
