/* 우리 가족 — 가족 웹 (family.dusonlaw.com). 아이폰 홈 화면 앱 기준 */
:root {
  --bg: #fff6f2;
  --bg2: #fdeee8;
  --card: #ffffff;
  --ink: #1d1b20;
  --ink2: #5f5a63;
  --ink3: #9a949e;
  --line: #f0e6e2;
  --fill: #f6efec;
  --brand: #ff5c6c;
  --brand2: #ff8a5b;
  --accent: var(--brand);
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 1px 2px rgba(60, 30, 20, .04), 0 6px 20px rgba(60, 30, 20, .06);
  --r: 22px;
  --tab: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --bg2: #1a1a1d;
    --card: #1e1e22;
    --ink: #f4f2f5;
    --ink2: #b8b3bc;
    --ink3: #7c7782;
    --line: #2c2a30;
    --fill: #26252a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all;
  overflow-wrap: anywhere;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.splash { position: fixed; inset: 0; display: grid; place-items: center; }
.splash img { width: 88px; height: 88px; border-radius: 22px; animation: pop .6s ease both; box-shadow: var(--shadow); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

/* ── 레이아웃 ── */
.screen { min-height: 100%; padding: calc(var(--safe-t) + 12px) 16px calc(var(--tab) + var(--safe-b) + 28px); max-width: 640px; margin: 0 auto; }
.screen > * { animation: rise .35s ease both; }
.screen > *:nth-child(2) { animation-delay: .03s; } .screen > *:nth-child(3) { animation-delay: .06s; }
.screen > *:nth-child(4) { animation-delay: .09s; } .screen > *:nth-child(5) { animation-delay: .12s; }

.top { display: flex; align-items: center; gap: 12px; padding: 8px 2px 14px; }
.top h1 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; flex: 1; }
.top .sub { display: block; font-size: 14px; color: var(--ink2); font-weight: 500; letter-spacing: 0; margin-bottom: 2px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--fill); flex: none; }
.avatar.lg { width: 72px; height: 72px; font-size: 40px; }

/* ── 카드 ── */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.card h2 .count { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink3); }
.card h2 .more { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--accent); }
.card .empty { color: var(--ink3); font-size: 15px; margin: 4px 0; }
.card.flat { box-shadow: none; background: var(--fill); }

/* 아이 첫 카드 */
.hero { border-radius: 28px; padding: 22px 20px; margin-bottom: 14px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--hero1, var(--brand2)), var(--hero2, var(--brand))); box-shadow: 0 10px 30px -12px var(--hero2, var(--brand)); }
.hero .hi { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.hero .date { opacity: .9; font-size: 15px; font-weight: 600; margin-top: 4px; }
.hero .big { position: absolute; right: 14px; bottom: -10px; font-size: 82px; opacity: .95; animation: wiggle 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.hero .chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; position: relative; }
.hero .chip { background: rgba(255, 255, 255, .22); color: #fff; backdrop-filter: blur(6px); }

/* ── 목록 줄 ── */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); min-height: 48px; }
.row:first-of-type, h2 + .row, .rows > .row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.row .s { font-size: 13px; color: var(--ink2); margin-top: 1px; overflow-wrap: anywhere; }
.row .time { width: 64px; flex: none; font-size: 14px; font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }
.row .time.allday { font-size: 12px; color: var(--ink3); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c, var(--ink3)); }
.dots { display: flex; gap: 3px; flex: none; }
.bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--c, var(--ink3)); flex: none; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border-radius: 99px; background: var(--fill); font-size: 13px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.chip.c { background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.chip.warn { background: #fff3d6; color: #b45309; }
.chip.bad { background: #ffe1e1; color: #c81e1e; }
.chip.ok { background: #dcfce7; color: #047857; }
@media (prefers-color-scheme: dark) {
  .chip.warn { background: #3a2c10; color: #fbbf24; } .chip.bad { background: #3b1717; color: #fca5a5; } .chip.ok { background: #0f2e22; color: #6ee7b7; }
}
.day-label { font-size: 13px; font-weight: 700; color: var(--ink3); margin: 14px 0 2px; text-transform: none; }
.day-label:first-of-type { margin-top: 0; }

/* 급식 */
.menu { display: flex; flex-wrap: wrap; gap: 7px; }
.menu span { background: var(--fill); padding: 7px 12px; border-radius: 14px; font-size: 15px; font-weight: 600; }
.menu span:first-child { background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); color: var(--c, var(--accent)); }
.meal-kid { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin: 12px 0 8px; color: var(--ink2); }
.meal-kid:first-of-type { margin-top: 0; }

/* AI 점검 (duson-admin 대시보드와 같은 생김새) */
.issue { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.issue:first-of-type { border-top: 0; padding-top: 4px; }
.issue .lv { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 16px; background: var(--fill); }
.issue.urgent .lv { background: #ffe1e1; } .issue.warn .lv { background: #fff3d6; } .issue.info .lv { background: #e0efff; }
@media (prefers-color-scheme: dark) { .issue.urgent .lv { background: #3b1717; } .issue.warn .lv { background: #3a2c10; } .issue.info .lv { background: #132a44; } }
.issue .main { flex: 1; min-width: 0; }
.issue .t { font-size: 15px; font-weight: 600; line-height: 1.4; }
.issue .s { font-size: 12px; color: var(--ink3); margin-top: 3px; }
.issue.done .t { color: var(--ink3); text-decoration: line-through; text-decoration-color: var(--ink3); }
.issue.done .s { color: var(--ok); }
.x { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink3); flex: none; font-size: 15px; }
.x:active { background: var(--fill); }
.ai-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink3); margin-top: 8px; }
.ai-foot button { color: var(--accent); font-weight: 700; font-size: 13px; margin-left: auto; padding: 6px 2px; }

/* ── 버튼 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 16px; font-size: 17px; font-weight: 700;
  background: var(--accent); color: #fff; width: 100%; transition: transform .12s, opacity .12s; }
.btn:active { transform: scale(.97); opacity: .9; }
.btn.soft { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.btn.ghost { background: var(--fill); color: var(--ink); }
.btn.sm { height: 38px; font-size: 15px; border-radius: 12px; padding: 0 14px; width: auto; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btns { display: flex; gap: 8px; }
.btns .btn { flex: 1; }

/* ── 입력 ── */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin: 0 0 6px 2px; }
.input { width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: 17px; outline: none; transition: border-color .15s; }
textarea.input { height: 96px; padding: 12px 14px; resize: none; line-height: 1.4; }
.input:focus { border-color: var(--accent); }
.quick { display: flex; gap: 8px; }
.quick .input { flex: 1; height: 46px; background: var(--fill); border-color: transparent; }
.quick .input:focus { background: var(--card); border-color: var(--accent); }
.quick .btn { width: 46px; height: 46px; padding: 0; border-radius: 14px; font-size: 24px; flex: none; }
.seg { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; margin: 0 -2px 12px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 38px; padding: 0 15px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 15px; white-space: nowrap; color: var(--ink2); }
.seg button.on { background: var(--accent); color: #fff; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button { height: 40px; padding: 0 14px; border-radius: 12px; background: var(--fill); font-weight: 700; font-size: 15px; color: var(--ink2); border: 2px solid transparent; }
.pick button.on { background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); color: var(--c, var(--accent)); border-color: var(--c, var(--accent)); }
.code-input { letter-spacing: .5em; text-align: center; font-size: 28px; font-weight: 800; height: 64px; font-variant-numeric: tabular-nums; }

/* 체크 목록 */
.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 52px; transition: opacity .25s, transform .25s; }
.check:first-child { border-top: 0; }
.check .box { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--line); flex: none; display: grid; place-items: center; transition: all .2s; }
.check.on .box { background: var(--ok); border-color: var(--ok); }
.check.on .box::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check.on .t { text-decoration: line-through; color: var(--ink3); }
.check.gone { opacity: 0; transform: translateX(30px); }
.check .main { flex: 1; min-width: 0; }
.check .t { font-size: 17px; font-weight: 600; }
.check .s { font-size: 12px; color: var(--ink3); }

/* ── 달력 ── */
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-head h1 { flex: 1; margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.cal-head button { width: 40px; height: 40px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-size: 18px; font-weight: 800; color: var(--ink2); }
.cal-head .today-btn { width: auto; padding: 0 12px; font-size: 14px; }
.cal { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 8px 6px; margin-bottom: 14px; }
.cal .wk, .cal .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal .wk span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink3); padding: 2px 0 6px; }
.cal .wk span:first-child, .cal .d.sun .n { color: #ef4444; }
.cal .wk span:last-child, .cal .d.sat .n { color: #3b82f6; }
.cal .d { height: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; border-radius: 14px; }
.cal .d .n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-size: 15px; font-weight: 600; }
.cal .d.out .n { color: var(--ink3); opacity: .55; }
.cal .d.today .n { background: var(--accent); color: #fff !important; font-weight: 800; }
.cal .d.sel { background: var(--fill); }
.cal .d .dots .dot { width: 6px; height: 6px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink2); font-weight: 600; margin: 0 4px 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ── 탭 막대 ── */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 6px 8px calc(var(--safe-b) + 6px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-top: 1px solid var(--line); display: flex; justify-content: space-around; }
.tabs a { flex: 1; max-width: 110px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--ink3); position: relative; }
.tabs a .i { font-size: 23px; line-height: 1; filter: grayscale(1); opacity: .55; transition: transform .15s; }
.tabs a.on { color: var(--accent); }
.tabs a.on .i { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }
.tabs .badge { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }

.fab { position: fixed; right: max(18px, calc(50% - 302px)); bottom: calc(var(--tab) + var(--safe-b) + 18px); z-index: 15; height: 56px; padding: 0 20px 0 16px; border-radius: 28px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px; box-shadow: 0 10px 24px -8px var(--accent); }
.fab .plus { font-size: 26px; line-height: 1; margin-top: -2px; }
.fab:active { transform: scale(.96); }

/* ── 아래에서 올라오는 창 ── */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 10, 10, .38); z-index: 40; opacity: 0; transition: opacity .22s; }
.sheet-bg.on { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg); border-radius: 26px 26px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 10px 18px calc(var(--safe-b) + 18px); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .9, .3, 1); max-width: 640px; margin: 0 auto; }
.sheet.on { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 16px; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 토스트 */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab) + var(--safe-b) + 18px); transform: translate(-50%, 20px); z-index: 50; opacity: 0; transition: all .25s;
  background: #26232a; color: #fff; padding: 0 8px 0 18px; height: 48px; border-radius: 24px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast button { color: #ffb3a7; font-weight: 800; padding: 0 10px; height: 40px; }
.toast:not(:has(button)) { padding-right: 18px; }

/* ── 로그인 ── */
.login { min-height: 100%; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 40px) 22px calc(var(--safe-b) + 24px); max-width: 480px; margin: 0 auto; }
.login .logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 10px 26px -10px var(--brand); margin-bottom: 18px; }
.login h1 { font-size: 28px; font-weight: 800; margin: 0 0 6px; letter-spacing: -.02em; line-height: 1.25; }
.login p.lead { color: var(--ink2); margin: 0 0 24px; font-size: 16px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who button { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 18px 10px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-weight: 800; font-size: 18px; border: 2.5px solid transparent; transition: transform .12s; }
.who button:active { transform: scale(.96); }
.who button .avatar { width: 64px; height: 64px; font-size: 36px; background: color-mix(in srgb, var(--c) 16%, transparent); }
.who button small { font-size: 12px; font-weight: 600; color: var(--ink3); }
.err { color: var(--bad); font-size: 14px; font-weight: 600; min-height: 20px; margin: 6px 2px 10px; }
.wait { text-align: center; margin-top: 10px; }
.wait .spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--fill); border-top-color: var(--accent); margin: 26px auto; animation: spin 1s linear infinite; }
.back { color: var(--ink2); font-weight: 700; margin-bottom: 18px; font-size: 15px; align-self: flex-start; padding: 6px 0; }
.grow { flex: 1; }

/* 홈 화면에 추가 안내 */
.install { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 20px; }
.install h3 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.install p { margin: 0 0 12px; color: var(--ink2); font-size: 14px; }
.install ol { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.install li { counter-increment: s; display: flex; align-items: center; gap: 12px; padding: 7px 0; font-weight: 600; font-size: 15px; }
.install li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.install .ios-share { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--fill); }
.install .ios-share svg { width: 16px; height: 16px; stroke: #007aff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install .add-box { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--ink2); border-radius: 5px; font-size: 14px; font-weight: 800; line-height: 1; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(8px); } }
.install .arrow { text-align: center; font-size: 30px; margin-top: 8px; animation: bob .8s ease-in-out infinite alternate; }

/* 부탁 */
.ask-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ask-grid button { background: var(--card); box-shadow: var(--shadow); border-radius: 20px; padding: 16px 12px; text-align: left; font-weight: 800; font-size: 16px; display: flex; flex-direction: column; gap: 6px; }
.ask-grid button .e { font-size: 30px; }
.ask-grid button small { font-weight: 600; color: var(--ink3); font-size: 12px; }
.ask-grid button:active { transform: scale(.97); }
.req .answer { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--fill); padding: 8px 12px; border-radius: 12px; }
.req .btns { margin-top: 8px; }
.new-badge { background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 8px; }

.list-link { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-weight: 600; }
.list-link:first-of-type { border-top: 0; }
.list-link .s { color: var(--ink3); font-size: 13px; font-weight: 500; }
.muted { color: var(--ink3); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.day-label + .row, .day-label + p + .row { border-top: 0; }
.install li > span:last-child { line-height: 1.9; }
.install .ios-share, .install .add-box { vertical-align: middle; margin: 0 2px; }
