/* 꼬리별 — 라이트 테마
   색 이름을 바꾸면 전체 화면이 같이 바뀐다 */
:root {
  --bg: #F5F7FA;        /* 바탕 (차가운 종이색) */
  --surface: #FFFFFF;   /* 카드·입력칸 */
  --ink: #1B2230;       /* 본문 글자 */
  --muted: #5E6878;     /* 보조 글자 */
  --line: #E1E6EE;      /* 구분선 */
  --tail: #0B7A75;      /* 혜성 꼬리 — 강조색 */
  --nucleus: #E8A317;   /* 혜성 핵 — '지금' 표시 */
  --danger: #B42318;
  --danger-bg: #FEF3F2;   /* 마감 지남 강조 바탕 */
  --danger-line: #FECDCA;

  --radius-s: 8px;
  --radius-l: 16px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", system-ui, sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --env-h: 0px;          /* 테스트 서버 노란 띠 높이 (body.has-env 일 때만) */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display 를 정한 요소도 hidden 이면 숨김 */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  word-break: keep-all;
}
a { color: var(--tail); }
:focus-visible { outline: 2px solid var(--tail); outline-offset: 2px; }

/* ── 전체 틀 ─────────────────────────────────── */
body.has-env { --env-h: 25px; }
.env-bar {
  position: sticky; top: 0; z-index: 12;
  height: var(--env-h);
  background: var(--nucleus);
  color: var(--ink);
  font-size: 13px;
  line-height: var(--env-h);
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shell { min-height: calc(100vh - var(--env-h)); }
.main {
  width: 100%;          /* PC 격자 안에서 내용 폭만큼 줄어들지 않게 */
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px calc(var(--nav-h) + var(--safe-b) + 32px);
}

/* ── 폰: 하단 탭바 ───────────────────────────── */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 10;
}
.nav :is(a, button) {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.nav :is(a, button)[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav :is(a, button)[aria-current="page"] svg { color: var(--tail); }
.nav .nav-add span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nav .nav-add svg {
  width: 48px; height: 48px;
  padding: 12px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
}
.nav-brand { display: none; }

/* ── PC: 왼쪽 메뉴 ───────────────────────────── */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px 1fr; }
  .nav {
    position: sticky;
    top: var(--env-h);
    height: calc(100vh - var(--env-h));   /* 노란 띠만큼 줄여 페이지가 밀리지 않게 */
    flex-direction: column;
    padding: 24px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
    gap: 2px;
  }
  .nav :is(a, button) {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-s);
    font-size: 15px;
  }
  .nav :is(a, button):hover { background: var(--bg); }
  .nav :is(a, button)[aria-current="page"] { background: var(--bg); }
  .nav-brand {
    order: -2;
    display: block;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    padding: 0 12px 20px;
  }
  .nav .nav-add { order: -1; margin-bottom: 12px; background: var(--ink); color: var(--surface); }
  .nav .nav-add:hover { background: var(--ink); }
  .nav .nav-add span { position: static; width: auto; height: auto; clip: auto; }
  .nav .nav-add svg { width: 20px; height: 20px; padding: 0; background: none; }
  .nav .nav-more { margin-top: auto; }
  .nav .badge { top: 50%; left: auto; right: 12px; margin: -9px 0 0; }
  .nav [data-sub-toggle] { display: none; }   /* 세부메뉴 있는 하단 탭은 PC 에선 펼침 메뉴로 */
  .nav-group { flex: 0 0 auto; }
  .nav-group summary {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-s);
    font-size: 15px; color: var(--muted);
    cursor: pointer; list-style: none;
  }
  .nav-group summary::-webkit-details-marker { display: none; }
  .nav-group summary::after { content: "›"; margin-left: auto; font-size: 18px; line-height: 1; transition: transform .15s ease; }
  .nav-group[open] summary::after { transform: rotate(90deg); }
  .nav-group summary:hover { background: var(--bg); }
  .nav-group summary.is-current { color: var(--ink); font-weight: 600; }
  .nav-group summary.is-current svg { color: var(--tail); }
  .nav-group summary .badge { right: 34px; }
  .nav .nav-sub { padding: 7px 12px 7px 48px; font-size: 14px; }
  .nav .nav-sub[aria-current="page"] { box-shadow: inset 3px 0 0 var(--tail); }

  .main { padding: 40px 40px 60px; }
}

/* ── + 부채 메뉴 ─────────────────────────────── */
.nav-add svg { transition: transform .2s ease; }
body.fan-open .nav-add svg { transform: rotate(45deg); }
.fan-backdrop {
  position: fixed; inset: 0; z-index: 9;       /* 메뉴(10) 바로 아래 */
  background: rgb(27 34 48 / .35);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
body.fan-open .fan-backdrop { opacity: 1; pointer-events: auto; }
.fan {
  position: fixed; z-index: 11;
  left: 50%; bottom: calc(var(--nav-h) / 2 + var(--safe-b));   /* + 버튼 가운데 */
  width: 0; height: 0;
  pointer-events: none;
}
body.fan-open .fan { pointer-events: auto; }
.fan-item {
  position: absolute; left: 0; top: 0;
  width: 56px; height: 56px;
  color: var(--ink); text-decoration: none;
  /* 가운데(+)에서 --a 방향으로 155px 날아간다 (양옆 이름표 3줄이 탭바에 안 걸리게) */
  transform: translate(-50%, -50%) rotate(var(--a)) translate(0) rotate(calc(-1 * var(--a))) scale(.3);
  opacity: 0;
  transition: transform .26s cubic-bezier(.2, .9, .3, 1.25), opacity .15s ease;
  transition-delay: calc(var(--i) * 35ms);
}
/* 부채 각도·순서 — 엄격 CSP 라 style= 대신 클래스 (add_menu() 각도가 늘면 여기도, 테스트가 잡음) */
.fan-a-130 { --a: -130deg; }
.fan-a-90 { --a: -90deg; }
.fan-a-50 { --a: -50deg; }
.fan-i0 { --i: 0; }
.fan-i1 { --i: 1; }
.fan-i2 { --i: 2; }
body.fan-open .fan-item {
  transform: translate(-50%, -50%) rotate(var(--a)) translate(155px) rotate(calc(-1 * var(--a))) scale(1);
  opacity: 1;
}
.fan-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--tail);
  box-shadow: 0 4px 14px rgb(27 34 48 / .18);
}
.fan-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 4px;
  font-size: 13px; font-weight: 600; line-height: 1.25; text-align: center; white-space: nowrap;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgb(27 34 48 / .82);   /* 뒤 화면 글자와 겹쳐도 읽히게 */
  color: var(--surface);
}
.fan-label small { display: block; font-size: 11px; font-weight: 400; line-height: 1.25; }
.fan-label small.soon { opacity: .8; }

@media (min-width: 900px) {
  /* PC: 부채 대신 '추가' 버튼 아래로 펼쳐지는 목록 */
  .fan {
    left: 12px; top: calc(118px + var(--env-h)); bottom: auto;   /* '추가' 버튼 바로 아래 */
    width: 196px; height: auto;
    display: flex; flex-direction: column; gap: 2px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    box-shadow: 0 8px 24px rgb(27 34 48 / .14);
    opacity: 0; transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease;
  }
  body.fan-open .fan { opacity: 1; transform: none; }
  .fan-item, body.fan-open .fan-item {
    position: static;
    display: flex; align-items: center; gap: 10px;
    width: auto; height: auto;
    padding: 8px 10px;
    border-radius: var(--radius-s);
    transform: none; opacity: 1; transition: none;
  }
  .fan-item:hover { background: var(--bg); }
  .fan-icon { width: 32px; height: 32px; box-shadow: none; background: var(--bg); }
  .fan-icon svg { width: 18px; height: 18px; }
  .fan-label { position: static; transform: none; margin: 0; padding: 0; background: none; text-align: left; color: var(--ink); font-size: 15px; }
  .fan-label small { display: block; color: var(--muted); font-size: 12px; }
  .fan-label small.soon { display: inline-block; margin-top: 2px; padding: 0 6px; border-radius: 999px; background: var(--bg); }
  .fan-backdrop { background: transparent; }
}

/* ── 더보기: 기능 격자 + 폰 시트 ─────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 6px;
  margin-bottom: 20px;
}
.feature-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 13px; color: var(--ink); text-decoration: none; text-align: center; line-height: 1.3;
}
.feature-grid small { font-size: 11px; color: var(--muted); }
.feature-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--bg);
  color: var(--tail);
}
.feature-grid a[aria-current="page"] .feature-icon { background: var(--tail); color: var(--surface); }
.more-page .feature-icon { background: var(--surface); border: 1px solid var(--line); }

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 9;
  background: rgb(27 34 48 / .35);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 11;
  left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b));   /* 탭바 바로 위 */
  max-height: calc(100vh - var(--nav-h) - var(--safe-b) - 48px);
  overflow-y: auto;
  padding: 8px 20px 12px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 24px rgb(27 34 48 / .12);
  transform: translateY(calc(100% + var(--nav-h)));
  visibility: hidden;
  transition: transform .25s cubic-bezier(.2, .8, .3, 1), visibility 0s linear .25s;
}
.sheet.is-open { transform: none; visibility: visible; transition: transform .25s cubic-bezier(.2, .8, .3, 1); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet .who { margin: 0 0 10px; font-size: 14px; }
.sheet .version { margin: 12px 0 0; }
.sheet-title { margin: 0 0 10px; font-weight: 700; font-size: 17px; }
.list a[aria-current="page"] { color: var(--tail); font-weight: 700; }
/* 더보기 2단: 격자 항목 → 세부메뉴 패널이 옆에서 들어온다 */
.sheet-panel:not([hidden]) { animation: panel-in .22s cubic-bezier(.2, .8, .3, 1); }
@keyframes panel-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sheet-head .sheet-title { margin: 0; }
.sheet-back {
  min-height: 40px; padding: 0 10px 0 4px;
  border: 0; background: none; font: inherit; font-size: 15px; color: var(--tail); cursor: pointer;
}

@media (max-width: 899px) {
  .nav .desk-only { display: none; }   /* 폰 하단 탭은 5칸만 */
  .nav .is-active-mobile, body[data-sheet="more-sheet"] .nav .nav-more { color: var(--ink); font-weight: 600; }
  .nav .is-active-mobile svg, body[data-sheet="more-sheet"] .nav .nav-more svg { color: var(--tail); }
}
@media (min-width: 900px) {
  .sheet, .sheet-backdrop { display: none; }   /* PC 는 왼쪽 메뉴에 다 보이고, 더보기는 페이지로 */
  .more-page .feature-grid { display: none; }
}

/* ── 오늘 화면 ───────────────────────────────── */
.today-head { margin: 8px 0 28px; }
.greet { color: var(--muted); margin: 0; }
.date {
  font-size: clamp(44px, 12vw, 64px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 4px 0 0;
}
.weekday { font-size: 20px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: -0.01em; }
.comet { display: block; width: 100%; height: auto; margin-top: 18px; overflow: visible; }
.comet .track { stroke: var(--line); }
.comet .tail { stroke: var(--tail); }
.comet .nucleus { fill: var(--nucleus); }
.comet-caption { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

.section { margin-top: 32px; }
.section h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.01em; }
.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-l);
  padding: 20px;
  color: var(--muted);
  font-size: 15px;
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 14px; text-decoration: none; }
.count { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }

/* ── 할 일 ───────────────────────────────────── */
.todos {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
}
.todo { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.todo:last-child { border-bottom: 0; }
.todo form { flex: 0 0 auto; padding-right: 10px; }
.done-btn {
  min-width: 56px; min-height: 36px;   /* 손가락으로 누르기 쉬운 크기 */
  padding: 6px 12px;
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid var(--tail);
  border-radius: 999px;
  background: var(--surface);
  color: var(--tail);
  cursor: pointer;
}
.done-btn:hover { background: var(--tail); color: var(--surface); }
.is-done .done-btn { border-color: var(--line); color: var(--muted); font-weight: 500; }
.todo.htmx-swapping { opacity: 0; transition: opacity .2s ease; }
.todo-body {
  flex: 1;
  min-width: 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 12px 8px 12px 16px;
  color: var(--ink);
  text-decoration: none;
}
.todo-title { overflow-wrap: anywhere; }
.is-done .todo-title { color: var(--muted); text-decoration: line-through; }
.due, .has-memo { font-size: 13px; color: var(--muted); }
.due-today { color: var(--tail); font-weight: 600; }
.due-overdue { color: var(--danger); font-weight: 600; }
.has-memo::before { content: "· "; }

.quick-add { margin-top: 12px; display: grid; gap: 8px; }
.quick-add input {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
}
.quick-add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick-add-row input[type=date] { width: auto; flex: 1 1 140px; padding: 8px 10px; }
.chips { display: flex; gap: 6px; }
.chips button {
  padding: 7px 12px;
  font: inherit; font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.chips button[aria-pressed="true"] { border-color: var(--tail); color: var(--tail); font-weight: 600; }
.btn.btn-inline { display: inline-block; width: auto; padding: 9px 18px; }
.overdue-alert {
  margin-top: 0;
  padding: 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-l);
  background: var(--danger-bg);
}
.overdue-alert h2 { color: var(--danger); }
.overdue-alert .todos { border-color: var(--danger-line); }
.badge {
  position: absolute; top: 6px; left: 50%; margin-left: 6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.nav :is(a, button) { position: relative; }
.complete-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.complete-bar span { color: var(--muted); }

.tag {
  font-size: 12px; line-height: 1.5;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.tag-shared { color: var(--tail); }
.quick-more { font-size: 14px; text-decoration: none; justify-self: start; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row > .field, .field-row input { min-width: 0; }   /* 날짜·시간 칸이 좁은 폰에서 넘치지 않게 */
.field select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
}
.repeat { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px 2px; margin: 4px 0 18px; }
.repeat legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.repeat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.repeat-row select, .repeat-every input {
  padding: 10px 12px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
}
.repeat-row select { flex: 1 1 140px; }
.repeat-every { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.repeat-every input { width: 64px; }
.day-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 40px)); gap: 5px; margin-bottom: 4px; }   /* 7요일 한 줄 */
.day-chips > div, .day-chips > div > div { display: contents; }   /* Django 체크박스 묶음 껍데기 무시 */
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-chip span {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 1;
  border: 1px solid var(--line); border-radius: 50%;
  font-size: 14px; color: var(--muted); cursor: pointer;
}
.day-chip input:checked + span { background: var(--tail); border-color: var(--tail); color: var(--surface); font-weight: 600; }
.day-chip input:focus-visible + span { outline: 2px solid var(--tail); outline-offset: 2px; }
.day-help { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.tag-repeat { color: var(--tail); }
.share { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px 2px; margin: 4px 0 18px; }
.share legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.share .help { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.field input[type=checkbox] { width: auto; margin: 0 6px 0 0; accent-color: var(--tail); }
.field label:has(input[type=checkbox]) { display: inline-flex; align-items: center; font-weight: 400; margin: 0 16px 6px 0; }

.done-list summary { cursor: pointer; font-size: 17px; font-weight: 700; margin-bottom: 10px; }

/* 추가 화면 '더 정하기' 접힘 */
.more-fields { margin: 4px 0 14px; }
.more-fields summary {
  display: flex; align-items: center; gap: 6px; min-height: 44px;
  list-style: none; cursor: pointer; font-weight: 600; color: var(--tail);
}
.more-fields summary::-webkit-details-marker { display: none; }
.more-fields summary::before { content: "▸"; }
.more-fields[open] summary::before { content: "▾"; }
.more-fields summary span { font-weight: 400; font-size: 14px; color: var(--muted); }
.more-fields[open] summary { margin-bottom: 8px; }

/* 화면 안 상단 탭 (core/_subtabs.html) — 칸을 똑같이 나눠 옆 스크롤 없음 */
.subtabs {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  margin: -6px 0 20px; padding: 4px;
  background: var(--line); border-radius: var(--radius-s);
}
.subtabs a {
  display: grid; place-items: center; min-height: 40px;
  border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 15px;
}
.subtabs a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgb(27 34 48 / .08); }
@media (min-width: 900px) {
  .subtabs { display: none; }   /* 왼쪽 메뉴 세부메뉴와 같아서 PC 에선 숨김 (기본 규칙보다 뒤에 둬야 함) */
  .subtabs.scope-tabs { display: grid; }   /* 일정 고치기 '이 날만/반복 전체'는 PC 에서도 */
}

/* 오늘 화면 한 줄 링크 (예: 장보기 3개 남았어요 →) */
.today-link { display: block; margin-top: 10px; font-size: 15px; text-decoration: none; }

/* ── 장보기 ──────────────────────────────────── */
.shop-add { margin: 0 0 12px; }
.shop-add .quick-add-row { flex-wrap: nowrap; }
.shop-add .quick-add-row input { flex: 1; min-width: 0; }
.shop-board > .errors { margin: -4px 0 12px; }
.shop-frequent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.shop-frequent span { font-size: 13px; color: var(--muted); margin-right: 2px; }
.shop-frequent button {
  min-height: 36px; padding: 6px 12px;
  font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.shop-frequent .shop-frequent-edit { padding: 6px 4px; font-size: 14px; color: var(--muted); }
.shop-hint { margin: -6px 0 14px; font-size: 14px; color: var(--muted); }
.shop-forget-name { flex: 1; min-width: 0; padding: 14px 16px; }
.shop-item form.shop-forget { flex: 0 0 auto; }
.shop-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden;
}
.shop-item { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-item form { flex: 1; min-width: 0; }
.shop-check {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 50px; padding: 12px 8px 12px 16px;
  font: inherit; text-align: left; color: var(--ink);
  border: 0; background: none; cursor: pointer;
}
.shop-box {
  flex: 0 0 24px; height: 24px;
  display: grid; place-items: center;
  border: 2px solid var(--tail); border-radius: 50%;
  font-size: 14px; font-weight: 700; color: var(--surface);
}
.shop-name { overflow-wrap: anywhere; }
.is-bought .shop-box { background: var(--tail); }
.is-bought .shop-name { color: var(--muted); text-decoration: line-through; }
.shop-edit { flex: 0 0 auto; padding: 14px 16px; font-size: 14px; color: var(--muted); text-decoration: none; }
.btn-text { border: 0; background: none; font: inherit; font-size: 14px; color: var(--tail); cursor: pointer; padding: 6px 4px; }

.back { display: inline-block; font-size: 14px; text-decoration: none; margin-top: 4px; }
.card-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; }
.danger-zone { margin-top: 20px; text-align: center; }
.btn-text-danger { border: 0; background: none; color: var(--danger); font: inherit; cursor: pointer; padding: 10px; }

/* ── 할 일·일정 안내 (todos/_what.html) ───────── */
.what { list-style: none; margin: -10px 0 16px; padding: 0; font-size: 14px; color: var(--ink); }
.what b { color: var(--tail); margin-right: 4px; }
.what span { color: var(--muted); }

/* ── 일정 ───────────────────────────────────── */
.events { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.event { border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; }
.event-body { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px; color: var(--ink); text-decoration: none; }
.event-time { flex: 0 0 auto; font-size: 14px; color: var(--muted); white-space: nowrap; }
.event-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* 긴 제목은 말줄임 */
.event-title small { color: var(--muted); font-size: 13px; }
.event-body .tag { flex: 0 0 auto; white-space: nowrap; }
.event-repeat { flex: 0 0 auto; font-size: 13px; }
.event-sub { font-size: 15px; font-weight: 700; color: var(--muted); margin: 14px 0 8px; }
.event-day h2 { font-size: 15px; }
.event-day { margin-top: 20px; }
.event-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.event-actions .btn { text-decoration: none; }
.event-cats { font-size: 14px; text-decoration: none; }
.event-past { margin-top: 24px; text-align: center; }
.event-series { font-size: 14px; color: var(--muted); margin: -10px 0 14px; }
.dot { flex: 0 0 auto; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--dot, #98A2B3); }
.dot-blue { --dot: #2E6BE6; }
.dot-orange { --dot: #E8730C; }
.dot-green { --dot: #2E9E4F; }
.dot-purple { --dot: #7A4FD6; }
.dot-pink { --dot: #D6457F; }
.dot-teal { --dot: #0B7A75; }
.dot-gray { --dot: #98A2B3; }
.cat-pick { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.cat-pick legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 6px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }   /* 줄바꿈되는 버튼 — 옆 스크롤 없음 */
.cat-chips > div, .cat-chips > div > div { display: contents; }   /* Django 라디오 묶음 껍데기 무시 */
.cat-chip { position: relative; }
.cat-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cat-chip span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; min-height: 36px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 14px; cursor: pointer;
}
.cat-chip input:checked + span { border-color: var(--tail); color: var(--tail); font-weight: 700; box-shadow: inset 0 0 0 1px var(--tail); }
.cat-chip input:focus-visible + span { outline: 2px solid var(--tail); outline-offset: 2px; }
.cat-manage { display: inline-block; margin-top: 8px; font-size: 13px; text-decoration: none; }
.cat-help { font-size: 14px; color: var(--muted); margin: -10px 0 14px; }

/* ── 달력 (schedule/_month.html · 오늘 화면 '이번 주') — 폰 360px 에서도 7칸이 넘치지 않게 ── */
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cal-title { flex: 1; margin: 0; text-align: center; font-size: 18px; font-weight: 700; }
.cal-nav { flex: 0 0 44px; display: grid; place-items: center; height: 44px; border-radius: 50%; font-size: 26px; line-height: 1; color: var(--ink); text-decoration: none; }
a.cal-nav:hover { background: var(--line); }
.cal-go-today { flex: 0 0 auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; text-decoration: none; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
  padding: 6px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
}
.cal-wd { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  min-width: 0; height: 58px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0;
  border: 2px solid transparent; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none;
}
.cal-day:hover { background: var(--bg); }
.cal-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 15px; line-height: 1; }
.cal-wd.wd-0, .cal-day.wd-0 .cal-num { color: var(--danger); }   /* 일요일 빨강 */
.cal-wd.wd-6, .cal-day.wd-6 .cal-num { color: #2E6BE6; }          /* 토요일 파랑 */
.cal-day.is-today .cal-num { background: var(--tail); color: var(--surface); font-weight: 700; }
.cal-day.is-picked { border-color: var(--tail); }
.cal-day.is-out { opacity: .4; }   /* 앞뒤 달 날짜 */
.cal-dots { display: flex; align-items: center; justify-content: center; gap: 2px; height: 8px; max-width: 100%; }
.cal-dots .dot { width: 6px; height: 6px; }
.cal-dots small { font-size: 10px; line-height: 1; color: var(--muted); }
.cal-check { height: 12px; font-size: 11px; line-height: 12px; }
.cal-todo-open { color: var(--tail); }
.cal-todo-overdue { color: var(--danger); }
.cal-todo-done { color: var(--muted); opacity: .5; }
.cal-todo-preview { color: var(--tail); opacity: .35; }   /* 반복 할 일 미리 보기 */
.cal-list { margin-top: 20px; }
.cal-list h2 { font-size: 16px; }
.cal-list .events, .cal-list .todos { margin-bottom: 10px; }
.cal-actions { margin-top: 12px; }
.is-preview .todo-body { color: var(--muted); }
.is-preview .todo-title { color: var(--muted); }
.preview-help { flex-basis: 100%; font-size: 12px; color: var(--muted); }
@media (min-width: 900px) {
  .cal-day { height: 76px; }
  .cal-dots { height: 10px; gap: 3px; }
  .cal-dots .dot { width: 8px; height: 8px; }
}

/* ── 시계 다이얼 (static/js/clock.js) ─────────── */
.clock-trigger {
  width: 100%; padding: 12px 14px;
  font: inherit; text-align: left; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
  cursor: pointer;
}
.clock-trigger.is-empty { color: var(--muted); }
dialog.clock {
  width: min(320px, calc(100vw - 32px));
  padding: 18px 18px 14px;
  border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 40px rgb(27 34 48 / .25);
}
dialog.clock::backdrop { background: rgb(27 34 48 / .4); }
@media (max-width: 899px) {
  /* 키패드 위로 — 테스트 서버 노란 띠(--env-h)와 노치(안전 여백) 아래에 둔다 */
  dialog.clock.is-typing { margin-top: calc(12px + var(--env-h) + env(safe-area-inset-top, 0px)); }
}
.clock-head { margin-bottom: 10px; }
.clock-time { display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
.clock-half { font-size: 20px; font-weight: 600; color: var(--ink); margin-right: 6px; }
.clock-part { font: inherit; color: var(--muted); background: none; border: 0; border-radius: var(--radius-s); padding: 0 6px; cursor: pointer; }
.clock-part.on { color: var(--tail); background: var(--bg); }
.clock-type {
  width: 1.7em; padding: 0 4px;
  font: inherit; text-align: center; color: var(--tail);
  border: 2px solid var(--tail); border-radius: var(--radius-s); background: var(--surface);
}
.clock-type::placeholder { color: var(--line); }
.clock-type.is-bad { border-color: var(--danger); color: var(--danger); }
.clock-hint { margin: 2px 0 10px; font-size: 12px; color: var(--muted); text-align: center; }
.clock-ampm { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.clock-ampm button {
  min-height: 44px;   /* 손가락 크기 */
  font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.clock-ampm button[aria-pressed="true"] { background: var(--tail); border-color: var(--tail); color: var(--surface); font-weight: 700; }
.clock-ampm button[aria-pressed="true"]::after { content: "✓"; margin-left: 6px; }
.clock-face { display: block; width: 100%; max-width: 260px; margin: 0 auto; touch-action: none; user-select: none; cursor: pointer; }
.clock-face:focus-visible { outline: 2px solid var(--tail); outline-offset: 4px; border-radius: 50%; }
.clock-bg { fill: var(--bg); }
.clock-hand { stroke: var(--tail); stroke-width: 2; }
.clock-center, .clock-knob { fill: var(--tail); }
.clock-nums text { font-size: 15px; text-anchor: middle; dominant-baseline: central; fill: var(--ink); pointer-events: none; }
.clock-nums text.on { fill: var(--surface); font-weight: 700; }
.clock-quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 8px; }
.clock-quick button { font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.clock-actions { display: flex; align-items: center; gap: 4px; }
.clock-actions span { flex: 1; }
.clock-actions button { font: inherit; font-size: 15px; padding: 10px 12px; border: 0; background: none; color: var(--tail); font-weight: 600; cursor: pointer; border-radius: var(--radius-s); }
.clock-actions .clock-clear { color: var(--muted); font-weight: 400; }

/* ── 목록 (더보기) ───────────────────────────── */
.list { background: var(--surface); border-radius: var(--radius-l); border: 1px solid var(--line); overflow: hidden; }
.list > * {
  display: block;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.list > *:last-child { border-bottom: 0; }
.list form { padding: 0; }
.list form button { width: 100%; padding: 16px 18px; border: 0; background: none; font: inherit; text-align: left; color: var(--danger); cursor: pointer; }
.version { font-size: 13px; color: var(--muted); text-align: center; margin-top: 24px; }
.list .sub { display: block; font-size: 13px; color: var(--muted); }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin: 8px 0 20px; }
.who { color: var(--muted); margin: -12px 0 20px; }

/* ── 권한 현황 표 ───────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.perm-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.perm-table th, .perm-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.perm-table th { font-weight: 600; color: var(--muted); }
.perm-table td.c { text-align: center; color: var(--tail); }
.perm-table small { color: var(--muted); }

/* ── 로그인·가입 화면 ─────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-box { width: min(380px, 100%); }
.auth-brand { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
}
.field .help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field .help ul { margin: 0; padding-left: 18px; }
.errors { color: var(--danger); font-size: 14px; margin: 4px 0 0; padding-left: 18px; }
.btn {
  display: block;
  width: 100%;
  padding: 13px;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
}
.btn.btn-outline { background: var(--surface); color: var(--ink); border: 1px dashed var(--muted); }
.btn.btn-link { text-align: center; text-decoration: none; }
.narrow { max-width: 420px; }
.gap-top { margin-top: 20px; }
.dev-login { margin-top: 20px; text-align: center; }
.dev-login .help { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.auth-foot { margin: 28px 0 0; text-align: center; font-size: 13px; }
.auth-foot a, .version a { color: var(--muted); }
/* 개인정보처리방침 */
.policy { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.policy p { margin: 0 0 14px; }
.policy a { color: inherit; }
.policy-date { font-size: 13px; color: var(--muted); }
.notice {
  background: var(--surface);
  border-left: 3px solid var(--tail);
  padding: 12px 14px;
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  margin-bottom: 16px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── 구글 캘린더 연동 ─────────────────────────── */
.form-lock { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-lock:disabled { opacity: .75; }
.gcal-fake, .gcal-hold { background: #FFF4D6; border: 1px solid var(--nucleus); border-radius: var(--radius-s); padding: 10px 14px; font-size: 14px; margin: 0 0 16px; }
.gcal-card > * + * { margin-top: 12px; }
.gcal-hold p { margin: 0 0 10px; }
.gcal-hold form { display: flex; flex-direction: column; gap: 8px; }
.gcal-fake-list { font-size: 13px; color: var(--muted); padding-left: 18px; }
.gcal-card p { margin: 0; }
.gcal-state { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.gcal-state.is-warn { color: var(--danger); }
.gcal-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; margin: 0; }
.gcal-info dt { color: var(--muted); }
.gcal-info dd { margin: 0; overflow-wrap: anywhere; }
.gcal-info dd a { margin-left: 6px; font-size: 14px; }
.gcal-card .help { font-size: 13px; color: var(--muted); }
.gcal-off { margin-top: 20px; }
.gcal-off summary { cursor: pointer; color: var(--danger); padding: 8px 0; }
.gcal-off-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.gcal-off-buttons .btn { text-align: center; text-decoration: none; }
.gcal-cals { border: 0; padding: 0; margin: 0 0 14px; }
.gcal-cals legend { font-weight: 600; margin-bottom: 8px; }
.gcal-cal { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.gcal-cal small { color: var(--muted); }
.gcal-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); margin: -6px 0 12px; }
.gcal-status form { display: inline; }
.gcal-status .btn-text { font-size: 13px; padding: 2px 4px; }
.gcal-status-err { color: var(--danger); }
.visit .event-title small { display: block; overflow: hidden; text-overflow: ellipsis; }   /* 진료 기록: 둘째 줄 (병원 · 약 수 · 다음) */
