:root {
  color-scheme: light;
  --bg: #f6f7f1;
  --surface: #ffffff;
  --surface-soft: #edf4ed;
  --text: #17221b;
  --sub: #5a685e;
  --brand: #326d4a;
  --brand-strong: #1f5637;
  --brand-soft: #dcebdd;
  --warm: #a33e36;
  --warn-bg: #fff1df;
  --warn-text: #7a4810;
  --line: #d5ddd4;
  --focus: #0b66c3;
  --shadow: 0 14px 36px rgba(35, 54, 42, .12);
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, [role="button"], input, select { min-height: 48px; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: -70px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--text); color: #fff; }
.skip-link:focus { top: 12px; }
.app-shell { width: min(100%, 760px); min-height: 100dvh; margin: 0 auto; background: var(--bg); }
.app-header { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; min-height: 64px; padding: max(8px, env(safe-area-inset-top)) 14px 8px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.app-header h1 { margin: 0; text-align: center; font-size: 20px; }
.icon-button { width: 48px; border: 0; border-radius: 14px; background: transparent; color: var(--text); font-size: 22px; }
.main { padding: 18px 16px calc(106px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 760px); display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 8px max(7px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--line); box-shadow: 0 -8px 26px rgba(35, 54, 42, .08); }
.nav-button { min-height: 58px; border: 0; border-radius: 14px; background: transparent; color: var(--sub); display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; }
.nav-button .nav-icon { font-size: 20px; line-height: 1; }
.nav-button[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; }
.nav-button.add { margin-top: -18px; border-radius: 20px; background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.stack { display: grid; gap: 14px; }
.hero { padding: 24px 20px; border-radius: 26px; background: linear-gradient(145deg, var(--brand-strong), #47835d); color: #fff; box-shadow: var(--shadow); }
.hero .eyebrow { opacity: .84; }
.hero h2 { margin: 8px 0 4px; font-size: clamp(26px, 8vw, 38px); line-height: 1.2; }
.hero p { margin: 0; line-height: 1.6; color: #eef8ef; }
.card { padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 5px 16px rgba(35,54,42,.04); }
.card h2, .card h3 { margin: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 2px 0; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head small { color: var(--sub); }
.primary, .secondary, .danger, .text-button { min-height: 48px; border-radius: 14px; padding: 0 16px; font-weight: 700; }
.primary { border: 1px solid var(--brand); background: var(--brand); color: #fff; }
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.danger { border: 1px solid #e8b8b3; background: #fff1ef; color: var(--warm); }
.text-button { border: 0; background: transparent; color: var(--brand-strong); }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.button-row > * { flex: 1 1 140px; }
.field { display: grid; gap: 7px; }
.field label, .field legend { font-weight: 700; font-size: 14px; }
.field-help { margin: 0; color: var(--sub); font-size: 12px; line-height: 1.5; }
.input, .select, .textarea { width: 100%; border: 1px solid #aebbb0; border-radius: 14px; background: var(--surface); color: var(--text); padding: 12px 13px; }
.textarea { min-height: 92px; resize: vertical; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--warm); box-shadow: 0 0 0 1px var(--warm); }
.form-grid { display: grid; gap: 16px; }
.date-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 7px; padding: 5px; border-radius: 16px; background: var(--surface-soft); }
.segmented button { border: 0; border-radius: 12px; background: transparent; color: var(--sub); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--brand-strong); box-shadow: 0 2px 8px rgba(35,54,42,.11); font-weight: 700; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); padding: 0 13px; }
.chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; }
.notice { padding: 13px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; line-height: 1.55; }
.notice.error { background: #fff0ee; color: #8d2f28; }
.notice.success { background: var(--brand-soft); color: var(--brand-strong); }
.empty { padding: 28px 18px; text-align: center; border: 1px dashed #b9c6bb; border-radius: 20px; color: var(--sub); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.empty strong { display: block; color: var(--text); margin-bottom: 6px; }
.record-list, .people-list { display: grid; gap: 9px; }
.record-card, .person-card { width: 100%; min-height: 72px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); padding: 14px; }
.record-card strong, .person-card strong { display: block; font-size: 15px; }
.record-card small, .person-card small { display: block; margin-top: 5px; color: var(--sub); line-height: 1.4; }
.badge { display: inline-flex; min-height: 28px; align-items: center; padding: 0 9px; border-radius: 999px; background: var(--surface-soft); color: var(--brand-strong); font-size: 11px; font-weight: 700; }
.detail-list { margin: 0; display: grid; gap: 10px; }
.detail-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--sub); font-size: 12px; }
.detail-row dd { margin: 4px 0 0; font-weight: 650; line-height: 1.5; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.calendar-head { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; text-align: center; }
.calendar-head button { border: 0; background: transparent; border-radius: 12px; font-size: 20px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekday { text-align: center; color: var(--sub); font-size: 11px; padding: 8px 0; }
.calendar-day { min-width: 0; min-height: 52px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text); display: grid; place-items: center; align-content: center; gap: 2px; }
.calendar-day[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.calendar-day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.calendar-day.muted { color: #9aa49c; }
.inline-add { padding: 12px; border-radius: 16px; background: var(--surface-soft); display: grid; gap: 9px; }
.inline-add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-grid .role-title { color: var(--sub); font-size: 12px; font-weight: 700; }
.role-group { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.role-group + .role-group { margin-top: 9px; }
.role-group h3 { margin: 0; color: var(--brand-strong); font-size: 14px; }
.connection-hub { background: linear-gradient(145deg, var(--surface), var(--brand-soft)); }
.connection-summary { display: grid; grid-template-columns: minmax(0, .8fr) 70px minmax(0, 1.2fr); align-items: center; gap: 6px; padding: 14px 10px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 82%, transparent); text-align: center; }
.connection-summary div { min-width: 0; }
.connection-summary strong, .connection-summary small { display: block; }
.connection-summary strong { font-size: 16px; }
.connection-summary small { margin-top: 4px; color: var(--sub); font-size: 11px; line-height: 1.35; }
.connection-summary > span { color: var(--brand-strong); font-size: 12px; font-weight: 700; }
.together-card { padding: 15px; border-radius: 18px; background: var(--brand-soft); }
.together-card h3 { margin: 10px 0 6px; font-size: 16px; }
.together-card p { margin: 0; line-height: 1.65; }
.together-card small { display: block; margin-top: 8px; color: var(--sub); line-height: 1.5; }
.media-form { overflow: hidden; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 9px; }
.photo-tile { position: relative; min-width: 0; margin: 0; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--line); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove { position: absolute; top: 7px; right: 7px; min-width: 42px; min-height: 42px; border: 0; border-radius: 999px; background: rgba(20,30,23,.82); color: #fff; font-size: 22px; }
.suggestion { display: grid; gap: 7px; padding: 13px; border: 1px solid #bfd8c4; border-radius: 16px; background: var(--brand-soft); }
.suggestion span { color: var(--sub); font-size: 12px; line-height: 1.5; }
.suggestion .secondary { justify-self: start; }
.share-toggle { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.share-toggle input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); }
.share-toggle strong, .share-toggle small { display: block; }
.share-toggle small { margin-top: 4px; color: var(--sub); font-size: 12px; line-height: 1.5; }
.media-detail { padding: 15px; border-radius: 18px; background: var(--surface-soft); }
.media-detail .photo-grid { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(94px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 32px), 520px); padding: 13px 16px; border-radius: 14px; background: var(--text); color: #fff; box-shadow: var(--shadow); text-align: center; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.onboarding { min-height: 100dvh; display: grid; align-content: center; gap: 18px; padding: 28px 20px; background: radial-gradient(circle at top right, #dbead9, transparent 44%), var(--bg); }
.brand-mark { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 22px; background: var(--brand); color: #fff; font-size: 26px; font-weight: 800; box-shadow: var(--shadow); }
.onboarding h1 { margin: 0; font-size: clamp(42px, 15vw, 68px); letter-spacing: -.06em; }
.onboarding p { margin: 0; color: var(--sub); font-size: 17px; line-height: 1.7; }

@media (min-width: 640px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border: 1px solid var(--line); border-radius: 28px; overflow: clip; box-shadow: var(--shadow); }
  .bottom-nav { bottom: 24px; border: 1px solid var(--line); border-radius: 0 0 28px 28px; }
  .main { padding-inline: 24px; }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg:#121713; --surface:#1a221c; --surface-soft:#222f26; --text:#f1f5f1; --sub:#b4c0b6; --brand:#77b68a; --brand-strong:#a7d8b4; --brand-soft:#263c2c; --warm:#ffaaa2; --warn-bg:#3e2d1c; --warn-text:#ffd3a0; --line:#354239; --focus:#72b7ff; --shadow:0 14px 36px rgba(0,0,0,.32); }
  .primary { color:#102317; }
  .danger { background:#3a2423; border-color:#71413d; }
}

.profile-avatar{width:64px;height:64px;border-radius:50%;object-fit:cover;background:#edf3e7;display:inline-flex;align-items:center;justify-content:center;font-size:36px;flex-shrink:0}.profile-date{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:10px}.profile-date input{min-width:0;width:100%}.person-profile{display:flex;align-items:center;gap:12px}.person-profile .profile-avatar{width:44px;height:44px;font-size:26px}

.self-profile-button{display:flex;flex-direction:column;align-items:center;gap:8px;width:100%;min-height:80px;padding:8px;border:0;border-radius:14px;background:transparent;color:inherit;cursor:pointer}.self-profile-button strong{overflow-wrap:anywhere;max-width:100%}.self-profile-button:focus-visible{outline:3px solid var(--brand-strong);outline-offset:2px}
