:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --tint: #efede7;
  --text: #1f1e1c;
  --text-2: #5f5d58;
  --text-3: #8f8c85;
  --border: rgba(31, 30, 28, 0.12);
  --border-2: rgba(31, 30, 28, 0.22);
  --accent: #2f6fd0;
  --accent-bg: #e6f0fb;
  --danger: #c43c3c;
  --danger-bg: #fcebeb;
  --success: #3b7a1a;
  --success-bg: #eaf3de;
  --warn: #8a5a0b;
  --warn-bg: #faeeda;
  --holiday: #c43c3c;
  --radius: 10px;
  --card-radius: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* 구성원 색상: 배경 / 글자 / 진한 점 */
  --blue-bg: #e6f1fb; --blue-fg: #0c447c; --blue: #378add;
  --pink-bg: #fbeaf0; --pink-fg: #72243e; --pink: #d4537e;
  --teal-bg: #e1f5ee; --teal-fg: #085041; --teal: #1d9e75;
  --amber-bg: #faeeda; --amber-fg: #633806; --amber: #ba7517;
  --purple-bg: #eeedfe; --purple-fg: #3c3489; --purple: #7f77dd;
  --coral-bg: #faece7; --coral-fg: #712b13; --coral: #d85a30;
  --green-bg: #eaf3de; --green-fg: #27500a; --green: #639922;
  --gray-bg: #f1efe8; --gray-fg: #444441; --gray: #888780;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1b; --surface: #262624; --surface-2: #2c2c2a; --tint: #33332f;
    --text: #f1efe8; --text-2: #b4b2a9; --text-3: #888780;
    --border: rgba(241, 239, 232, 0.12); --border-2: rgba(241, 239, 232, 0.24);
    --accent: #85b7eb; --accent-bg: #0c2f55;
    --danger: #f09595; --danger-bg: #4a1818;
    --success: #97c459; --success-bg: #213a0c;
    --warn: #fac775; --warn-bg: #412402;
    --holiday: #f09595;
    --blue-bg: #0c447c; --blue-fg: #e6f1fb;
    --pink-bg: #72243e; --pink-fg: #fbeaf0;
    --teal-bg: #085041; --teal-fg: #e1f5ee;
    --amber-bg: #633806; --amber-fg: #faeeda;
    --purple-bg: #3c3489; --purple-fg: #eeedfe;
    --coral-bg: #712b13; --coral-fg: #faece7;
    --green-bg: #27500a; --green-fg: #eaf3de;
    --gray-bg: #444441; --gray-fg: #f1efe8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--text-2); font-size: 13px; }
.faint { color: var(--text-3); font-size: 12px; }
.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 22px; height: 22px; }
.ic.sm { width: 15px; height: 15px; vertical-align: -2px; }
.hidden { display: none !important; }

/* ---------- 버튼·입력 ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface); cursor: pointer;
  white-space: nowrap; transition: background .12s, transform .06s;
}
.btn:hover { background: var(--tint); }
a.btn { color: var(--text); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--tint); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.icon { padding: 0; width: 38px; }
.btn.icon.sm { width: 32px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=datetime-local], input[type=number], input[type=url], input[type=search], input[type=month], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface); outline: none;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
label.field, div.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.seg button.on { background: var(--tint); color: var(--text); font-weight: 600; }

/* ---------- 레이아웃 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin-right: 10px; color: var(--text); }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: var(--radius); color: var(--text-2); font-size: 14px; white-space: nowrap; }
.tabs a:hover { background: var(--tint); }
.tabs a.on { background: var(--tint); color: var(--text); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
main { max-width: 1120px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 24px); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.bottomnav { display: none; }
@media (max-width: 860px) {
  .tabs { display: none; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); height: calc(var(--nav-h) + var(--safe-b));
  }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--text-3); background: none; border: 0; cursor: pointer; }
  .bottomnav a.on, .bottomnav button.on { color: var(--text); font-weight: 600; }
  .bottomnav .ic { width: 22px; height: 22px; }
}
@media (min-width: 861px) { main { padding-bottom: 40px; } }

/* ---------- 카드 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); padding: 14px 16px; }
.card-h { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.card-h .ic { color: var(--text-2); }
.card-h .more { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--text-3); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.item { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 14px; min-height: 34px; }
.item + .item { border-top: 1px solid var(--border); }
.item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.item.done .t { color: var(--text-3); text-decoration: line-through; }
.cb { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-2); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; color: var(--surface); }
.cb.on { background: var(--success); border-color: var(--success); }
.cb .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.empty { text-align: center; padding: 22px 10px; color: var(--text-3); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--tint); color: var(--text-2); white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--success-bg); color: var(--success); }
.pill.accent { background: var(--accent-bg); color: var(--accent); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

.av { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; flex-shrink: 0; }
.av.lg { width: 44px; height: 44px; font-size: 18px; }
.av.sm { width: 20px; height: 20px; font-size: 10.5px; }
.avs { display: inline-flex; } .avs .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); } .avs .av:first-child { margin-left: 0; }
.c-blue { background: var(--blue-bg); color: var(--blue-fg); } .c-pink { background: var(--pink-bg); color: var(--pink-fg); }
.c-teal { background: var(--teal-bg); color: var(--teal-fg); } .c-amber { background: var(--amber-bg); color: var(--amber-fg); }
.c-purple { background: var(--purple-bg); color: var(--purple-fg); } .c-coral { background: var(--coral-bg); color: var(--coral-fg); }
.c-green { background: var(--green-bg); color: var(--green-fg); } .c-gray { background: var(--gray-bg); color: var(--gray-fg); }
.bar-blue { background: var(--blue); } .bar-pink { background: var(--pink); } .bar-teal { background: var(--teal); } .bar-amber { background: var(--amber); }
.bar-purple { background: var(--purple); } .bar-coral { background: var(--coral); } .bar-green { background: var(--green); } .bar-gray { background: var(--gray); }

/* ---------- 홈 ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.clocks { display: flex; gap: 8px; flex-wrap: wrap; }
.clock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; line-height: 1.3; }
.clock b { font-size: 17px; font-variant-numeric: tabular-nums; }
.clock .faint { display: block; }
.progress { height: 7px; border-radius: 4px; background: var(--tint); overflow: hidden; }
.progress > div { height: 100%; border-radius: 4px; background: var(--success); }
.progress.over > div { background: var(--danger); }
.progress.near > div { background: var(--amber); }
.note { border-radius: var(--radius); padding: 9px 11px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.note + .note { margin-top: 7px; }
.photos-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--tint); }
.feed .item { font-size: 13px; align-items: flex-start; }

/* ---------- 캘린더 ---------- */
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-head h1 { font-size: 20px; min-width: 130px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.legend button { border: 0; cursor: pointer; font-size: 12px; padding: 3px 9px; border-radius: 99px; }
.legend button.off { opacity: .35; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 960px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } }
.month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); overflow: hidden; }
.month .dows, .month .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month .dows div { text-align: center; font-size: 12px; color: var(--text-3); padding: 7px 0; }
.month .dows div:first-child { color: var(--holiday); }
.day { min-height: 96px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); padding: 3px 3px 5px; cursor: pointer; position: relative; min-width: 0; }
.day:nth-child(7n+1) { border-left: 0; }
.day:hover { background: var(--surface-2); }
.day.other { background: var(--surface-2); }
.day.other .dn { opacity: .45; }
.day.sel { box-shadow: inset 0 0 0 2px var(--text); }
.dn { font-size: 12px; display: flex; align-items: center; gap: 4px; padding: 1px 3px; }
.dn b { font-weight: 500; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.day.today .dn b { background: var(--text); color: var(--bg); font-weight: 700; }
.day.sun .dn b, .day.hol .dn b { color: var(--holiday); }
.day.today.sun .dn b, .day.today.hol .dn b { color: var(--bg); }
.day.sat .dn b { color: var(--accent); }
.hol-name { font-size: 10px; color: var(--holiday); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hol-name.us { color: var(--text-3); }
.ev { display: block; font-size: 11px; line-height: 16px; padding: 0 4px; margin-top: 2px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.timed { background: transparent !important; padding-left: 2px; }
.ev.timed::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 3px; vertical-align: 1px; background: currentColor; }
.ev-more { font-size: 10.5px; color: var(--text-3); padding: 0 4px; }
@media (max-width: 640px) {
  .day { min-height: 74px; padding: 2px 1px 4px; }
  .ev { font-size: 10px; line-height: 14px; padding: 0 2px; border-radius: 3px; }
  .hol-name { display: none; }
  .cal-head h1 { font-size: 18px; min-width: 0; }
}
.daypanel { position: sticky; top: 76px; }
.agenda .a-item { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); cursor: pointer; align-items: stretch; }
.agenda .a-item:first-child { border-top: 0; }
.agenda .a-bar { width: 4px; border-radius: 2px; flex-shrink: 0; }
.agenda .a-time { width: 64px; flex-shrink: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.agenda .a-title { font-size: 14px; }
.addline { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 9px 11px; border: 1px dashed var(--border-2); border-radius: var(--radius); color: var(--text-2); font-size: 13.5px; cursor: pointer; background: none; width: 100%; }
.addline:hover { background: var(--tint); }
.tzbox { background: var(--tint); border-radius: var(--radius); padding: 9px 11px; font-size: 13px; color: var(--text-2); }
.tzbox b { color: var(--text); }
.detail-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14px; }
.detail-row > .ic { color: var(--text-2); margin-top: 2px; }
.comment { display: flex; gap: 9px; padding: 8px 0; }
.comment .body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-2); border-radius: 99px; padding: 4px 10px 4px 4px; cursor: pointer; font-size: 13px; background: var(--surface); }
.chip input { display: none; }
.chip:has(input:checked) { border-color: var(--text); background: var(--tint); font-weight: 600; }

/* ---------- 장보기 ---------- */
.shop-card.current { border: 1.5px solid var(--text); }
.shop-card .add { display: flex; gap: 6px; margin-top: 8px; }
.shop-card .add input { min-height: 36px; }
.qty { font-size: 12px; color: var(--text-3); }
.icon-btn { background: none; border: 0; padding: 4px; border-radius: 6px; color: var(--text-3); cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: var(--tint); color: var(--text); }
.new-card { border: 1.5px dashed var(--border-2); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 160px; cursor: pointer; color: var(--text-2); }
.new-card:hover { background: var(--surface); }

/* ---------- 나들이 ---------- */
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.place { cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s; }
.place:hover { border-color: var(--border-2); }
.place .name { font-weight: 600; font-size: 15px; line-height: 1.35; }
.place .sum { font-size: 13px; color: var(--text-2); }
.place .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: auto; padding-top: 4px; }
.section-title { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 600; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 4px; }
.ai-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--accent-bg); color: var(--accent); padding: 9px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.ai-status .btn { margin-left: auto; }
.ai-status.warn { background: var(--warn-bg); color: var(--warn); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th { text-align: left; font-weight: 500; color: var(--text-2); width: 92px; vertical-align: top; padding: 8px 8px 8px 0; white-space: nowrap; }
.info-table td { padding: 8px 0; vertical-align: top; white-space: pre-wrap; word-break: break-word; }
.info-table tr + tr th, .info-table tr + tr td { border-top: 1px solid var(--border); }
.linkbtns { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }

/* ---------- 가계부 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.catbar { display: grid; grid-template-columns: 70px 1fr 90px; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; }
.catbar .progress > div { background: var(--accent); }
.tx { display: grid; grid-template-columns: 54px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }

/* ---------- 앨범 ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.gallery a { position: relative; display: block; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--tint); }
.gallery .yr { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }

/* ---------- 모달 ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(15, 15, 14, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--border); }
.modal.wide { max-width: 640px; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-h h2 { flex: 1; font-size: 17px; }
.modal-body { padding: 8px 16px 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px 16px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); }
.modal-foot .left { margin-right: auto; }
@media (max-width: 640px) {
  .modal-wrap:has(.modal.sheet) { align-items: flex-end; padding: 0; }
  .modal.sheet { max-width: none; border-radius: 18px 18px 0 0; max-height: 92dvh; padding-bottom: var(--safe-b); animation: up .18s ease-out; }
  .modal.sheet::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 8px auto 0; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30%); opacity: .5; } }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 200; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 99px; font-size: 14px; transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (min-width: 861px) { #toasts { bottom: 24px; } }

/* ---------- 로그인 ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth .box { width: 100%; max-width: 380px; }
.auth h1 { margin: 10px 0 4px; }
.who { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 18px 0; }
.who button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: var(--card-radius); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; }
.who button.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.err-text { color: var(--danger); font-size: 13px; margin-top: 6px; min-height: 18px; }

.more-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.more-menu a { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: var(--text); }
.more-menu a .ic { width: 24px; height: 24px; color: var(--text-2); }
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.member-row:first-child { border-top: 0; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches label { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.swatches input { display: none; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* 날짜 입력칸: yyyy/mm/dd 표시 */
.datefield { position: relative; display: inline-block; width: 100%; min-width: 150px; vertical-align: middle; }
.datefield .df-text {
  display: flex; align-items: center; min-height: 40px; padding: 8px 11px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface); white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none;
}
.datefield .df-text.placeholder { color: var(--text-3); }
.datefield input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; min-height: 0; padding: 0; border: 0; }
.datefield:focus-within .df-text { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.dt { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 6px; }
.dt input[type=time] { padding: 8px 8px; }
@media (max-width: 640px) { .grid2.stack-sm { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* 전체 메뉴 (모바일: 왼쪽에서 펼쳐지는 메뉴) */
.menu-btn { display: none; margin-left: -6px; }
@media (max-width: 860px) { .menu-btn { display: inline-flex; } }
.drawer-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(15, 15, 14, 0); transition: background .18s; }
.drawer-wrap.open { background: rgba(15, 15, 14, 0.4); }
.drawer {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 82vw); background: var(--surface);
  border-right: 1px solid var(--border); padding: calc(env(safe-area-inset-top, 0px) + 12px) 10px calc(var(--safe-b) + 16px);
  transform: translateX(-100%); transition: transform .18s ease-out; overflow-y: auto;
}
.drawer-wrap.open .drawer { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.drawer a { display: flex; align-items: center; gap: 14px; padding: 12px 12px; border-radius: var(--radius); color: var(--text); font-size: 15.5px; }
.drawer a .ic { width: 22px; height: 22px; color: var(--text-2); }
.drawer a:hover { background: var(--tint); }
.drawer a.on { background: var(--tint); font-weight: 600; }
.drawer a.on .ic { color: var(--text); }

/* ---------- 메뉴 항상 표시 ---------- */
/* 넓은 화면(태블릿·컴퓨터): 왼쪽에 세로 메뉴 고정 */
.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100dvh; }
.sidenav {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 10px 16px; border-right: 1px solid var(--border); background: var(--surface);
}
.sidenav .brand { padding: 4px 10px 14px; margin: 0; }
.side-links { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-links a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--text-2); font-size: 15px; }
.side-links a .ic { width: 20px; height: 20px; }
.side-links a:hover { background: var(--tint); color: var(--text); }
.side-links a.on { background: var(--tint); color: var(--text); font-weight: 600; }
.side-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); color: var(--text); font-size: 14px; }
.side-me:hover { background: var(--tint); }
.main-col { min-width: 0; }
.main-col .topbar { display: none; }
.bottomnav { display: none !important; }
.daypanel { top: 16px; }
main { padding-bottom: 40px; }
#toasts { bottom: 24px; }

/* 휴대폰: 위에 집 이름, 아래에 모든 기능을 두 줄로 */
@media (max-width: 700px) {
  .shell { display: block; }
  .sidenav { display: none; }
  .main-col .topbar { display: block; }
  .daypanel { top: 76px; }
  .bottomnav {
    display: grid !important; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 54px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: auto;
    background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--text-3); }
  .bottomnav a.on { color: var(--text); font-weight: 600; }
  .bottomnav a .ic { width: 21px; height: 21px; }
  main { padding-bottom: calc(108px + var(--safe-b) + 24px); }
  #toasts { bottom: calc(108px + var(--safe-b) + 14px); }
}

/* 고정지출 */
.fixed-card { display: block; width: 100%; text-align: left; cursor: pointer; margin-bottom: 14px; font: inherit; color: inherit; }
.fixed-card:hover { border-color: var(--border-2); }
.fixed-totals { display: flex; gap: 22px; flex-wrap: wrap; margin: 6px 0 2px; }
.fixed-totals > div { display: flex; flex-direction: column; }
.fixed-totals b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.fx-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.fx-row.editing { background: var(--tint); border-radius: var(--radius); padding: 9px 8px; }

/* 가계부 달력 */
.bday { min-height: 78px; }
.bamt { font-size: 12px; font-weight: 600; text-align: right; padding: 0 4px; font-variant-numeric: tabular-nums; color: var(--text); }
.bamt.usd { color: var(--accent); }
.fx-dot { margin-left: auto; color: var(--text-3); display: inline-flex; }
.fx-dot .ic { width: 12px; height: 12px; }
.fx-today { background: var(--tint); border-radius: var(--radius); padding: 8px 10px; margin-top: 8px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.tx.nodate { grid-template-columns: 1fr auto auto; }
.daypanel .add-tx .row { gap: 6px; }
@media (max-width: 640px) { .bday { min-height: 58px; } .bamt { font-size: 10.5px; padding: 0 2px; } }

/* 나들이 추천 기록 페이지, 거절 버튼 */
.pager { display: inline-flex; gap: 4px; margin-left: auto; }
.pager button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text-2); }
.pager button.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.reject-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; padding: 2px 8px 2px 5px; border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); cursor: pointer; }
.reject-btn:hover { border-color: var(--danger); color: var(--danger); }
.reject-btn .ic { width: 12px; height: 12px; }

/* 홈 시계: 가로로 꽉 차게 */
.hello { flex-direction: column; align-items: stretch; }
.clocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; width: 100%; }
.clock { padding: 12px 16px; border-radius: var(--card-radius); }
.clock .faint { font-size: 13px; }
.clock b { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; display: block; line-height: 1.15; margin-top: 2px; }
@media (max-width: 640px) { .clock { padding: 10px 12px; } .clock b { font-size: 26px; } .clock .faint { font-size: 12px; } }

/* 홈 관리 */
.iot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.iot-dev { transition: border-color .12s; }
.iot-dev.on { border-color: var(--amber); }
.iot-dev.offline { opacity: .55; }
.iot-name { font-weight: 600; font-size: 14.5px; }
.iot-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.iot-toggle.on { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber); }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.shortcut { display: flex; align-items: center; gap: 12px; color: var(--text); }
.shortcut:hover { border-color: var(--border-2); }
.sc-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--tint); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; flex-shrink: 0; }

.or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 12px 0 2px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
input[type=email] { width: 100%; min-height: 40px; padding: 8px 11px; border-radius: var(--radius); border: 1px solid var(--border-2); background: var(--surface); outline: none; }
.lockbox { max-width: 380px; margin: 30px auto; text-align: center; }

/* 오늘의 운세 */
.fortune-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fortune-stars { color: var(--amber); letter-spacing: 1px; font-size: 15px; }
.fortune-sum { font-size: 14px; margin: 6px 0 10px; color: var(--text); }
.fortune-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; color: var(--text-2); }
.fortune-grid span { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 1px; }
.fortune-lucky { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.fortune-advice { margin-top: 10px; padding: 8px 10px; background: var(--tint); border-radius: var(--radius); font-size: 13.5px; }
@media (max-width: 640px) { .fortune-grid { grid-template-columns: 1fr; } }

/* 휴일 색: 일요일·한국 휴일 = 빨강, 토요일·미국(텍사스) 휴일 = 파랑 */
.day.ushol .dn b { color: var(--accent); }
.day.today.ushol .dn b { color: var(--bg); }
.hol-name.us { color: var(--accent); }
.day.sat.hol .dn b { color: var(--holiday); }
.day.today.sat.hol .dn b { color: var(--bg); }

/* 달력 년·월 선택, 스와이프 */
.month-title { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 6px; border-radius: var(--radius); cursor: pointer; color: var(--text); }
.month-title:hover { background: var(--tint); }
.month-title h1 { min-width: 0 !important; }
.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month-grid button { min-height: 44px; border-radius: var(--radius); border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 15px; }
.month-grid button.now { border-color: var(--accent); color: var(--accent); }
.month-grid button.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.month { touch-action: pan-y; }
.month.slide-left { animation: slideL .18s ease-out; }
.month.slide-right { animation: slideR .18s ease-out; }
@keyframes slideL { from { transform: translateX(0); } to { transform: translateX(-24px); opacity: .5; } }
@keyframes slideR { from { transform: translateX(0); } to { transform: translateX(24px); opacity: .5; } }

/* 앨범 */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.album-card { display: flex; flex-direction: column; gap: 4px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); font: inherit; }
.album-cover { aspect-ratio: 1; border-radius: 12px; background: var(--tint); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.g-item { position: relative; padding: 0; border: 0; background: none; cursor: pointer; display: block; }
.g-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--tint); }
.g-item .yr { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.modal.viewer-modal { background: #000; max-width: 1000px; border: 0; }
.viewer { position: relative; display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.viewer img { max-width: 100%; max-height: 82dvh; display: block; }
.v-close { position: absolute; top: 8px; right: 8px; z-index: 2; color: #fff !important; background: rgba(0,0,0,.4) !important; border: 0 !important; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.35); border: 0; color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.v-prev { left: 8px; } .v-next { right: 8px; }
.v-info { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 12.5px; }
