/* =============================================================================
 * base.css — 디자인 토큰 + 앱 셸 + 공통 컴포넌트
 * ========================================================================== */
:root {
  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #f0f2f5;
  --border:    #e2e5ea;
  --text:      #16181d;
  --text-2:    #5b6472;
  --text-3:    #8b94a3;
  --accent:    #4f46e5;
  --accent-ink:#ffffff;
  --accent-sub:#eef0ff;
  --ok:        #15803d;
  --ok-bg:     #e8f6ec;
  --warn:      #b45309;
  --warn-bg:   #fdf3e3;
  --bad:       #b91c1c;
  --bad-bg:    #fdeceb;
  --fat:       #e0703a;
  --muscle:    #2f7de1;
  --weight:    #6b7280;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(16,20,30,.05), 0 6px 20px rgba(16,20,30,.06);
  --maxw:      480px;
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0e1014; --surface:#171a20; --surface-2:#1f232b; --border:#2a2f39;
    --text:#e9ecf1; --text-2:#a3adbb; --text-3:#6f7987;
    --accent:#7c7cf7; --accent-sub:#232447;
    --ok:#4ade80; --ok-bg:#12281a; --warn:#fbbf24; --warn-bg:#2c2110;
    --bad:#f87171; --bad-bg:#2d1414;
    --fat:#f08a54; --muscle:#5b9df5;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg:#0e1014; --surface:#171a20; --surface-2:#1f232b; --border:#2a2f39;
  --text:#e9ecf1; --text-2:#a3adbb; --text-3:#6f7987;
  --accent:#7c7cf7; --accent-sub:#232447;
  --ok:#4ade80; --ok-bg:#12281a; --warn:#fbbf24; --warn-bg:#2c2110;
  --bad:#f87171; --bad-bg:#2d1414;
  --fat:#f08a54; --muscle:#5b9df5;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  font-size: 15px;
  line-height: 1.55;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1,h2,h3,h4 { margin:0; font-weight:700; letter-spacing:-.01em; }
p { margin:0 0 .6em; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:.9em;
       background: var(--surface-2); padding:1px 4px; border-radius:4px; }
kbd { font-family: ui-monospace, monospace; font-size:.85em; background:var(--surface-2);
      border:1px solid var(--border); border-bottom-width:2px; border-radius:4px; padding:1px 5px; }

/* --- 앱 셸 --------------------------------------------------------------- */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  /* 호스트가 :root 에 안전영역 패딩을 주므로 그만큼 빼야 세로 스크롤이 안 생긴다 */
  min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  display: flex; flex-direction: column;
  position: relative;
  box-shadow: 0 0 0 1px var(--border);
}


.appbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; min-height: 52px;
}
.appbar__back {
  background:none; border:none; cursor:pointer; padding:6px; margin-left:-6px;
  color: var(--text-2); font-size: 20px; line-height:1; border-radius:8px;
}
.appbar__back:hover { background: var(--surface-2); }
.appbar__title { font-size: 16px; font-weight: 700; flex: 1; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.appbar__sub { font-size: 11px; color: var(--text-3); font-weight:500; }
.appbar__actions { display:flex; gap:6px; }

.main { flex: 1; padding: 16px 16px 96px; }

/* 앱바 컨트롤은 한 손 엄지가 가장 못 닿는 자리에 있다 — 타깃을 키운다 */
.appbar { min-height: 56px; }
.appbar__actions .btn,
.appbar__back {
  min-width: 40px; min-height: 40px; padding: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}

.tabbar {
  position: sticky; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar__item {
  background:none; border:none; cursor:pointer; padding:6px 2px;
  display:flex; flex-direction:column; align-items:center; gap:3px;
  color: var(--text-3); font-size: 10.5px; font-weight:600; border-radius:10px;
  position: relative;
}
.tabbar__item .ico { font-size:18px; line-height:1; }
/* 받은 친구 요청 표시. uid 배지가 top:-5px right:-5px 에 뜨므로 겹치지 않게 아이콘 옆에 둔다 */
.tabbar__item.has-dot::after {
  content:''; position:absolute; top:4px; left:50%; margin-left:9px;
  width:7px; height:7px; border-radius:50%; background: var(--bad);
}
.tabbar__item.is-active { color: var(--accent); }
.tabbar__item:hover { background: var(--surface-2); }

/* --- 화면 전환 ----------------------------------------------------------- */
.screen { display: none; }
.screen.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce) { .screen.is-active { animation: none; } }

/* --- 카드 --------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card--flat { box-shadow:none; }
.card--accent { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card__head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px; }
.card__title { font-size: 14px; font-weight: 700; }
.card__sub { font-size: 12px; color: var(--text-3); font-weight:500; }

.section-title { font-size:12px; font-weight:700; color:var(--text-3);
  text-transform:uppercase; letter-spacing:.06em; margin:20px 0 8px; }
.section-title:first-child { margin-top:0; }

/* --- 버튼 --------------------------------------------------------------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border:1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: var(--radius-sm); cursor:pointer;
  font-weight:600; font-size:14px; transition: background .12s, border-color .12s, transform .06s;
  position: relative;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity:.45; cursor:not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, black); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.btn--sm { padding: 6px 10px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn-row { display:flex; gap:8px; flex-wrap:wrap; }
.btn-row--stack { flex-direction:column; }
.btn-row > .btn { flex:1; }

/* --- 폼 ----------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field__label { display:flex; align-items:center; gap:6px; font-size:12.5px;
  font-weight:600; color: var(--text-2); margin-bottom:5px; }
.field__hint { font-size:11.5px; color: var(--text-3); margin-top:4px; }
.field__err { font-size:11.5px; color: var(--bad); margin-top:4px; font-weight:600; }
/* 입력 글자는 16px 밑으로 내려가면 안 됩니다.
   iOS 사파리는 15px 이하 입력에 포커스가 가면 페이지를 확대합니다.
   헬스장에서 숫자 세 칸을 넣는 동안 탭할 때마다 화면이 튑니다.
   본문은 15px 로 두고 입력만 올립니다. */
.input, .select, .textarea {
  width:100%; padding: 10px 12px; border:1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); outline:none;
  font-size: 16px;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-sub);
}
.input--num { font-variant-numeric: tabular-nums; }
.input-unit { display:flex; align-items:center; gap:8px; }
.input-unit .input { flex:1; }
.input-unit__u { font-size:12.5px; color:var(--text-3); font-weight:600; min-width:24px;
  white-space:nowrap; flex:none; }
.range { width:100%; accent-color: var(--accent); }

.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip {
  padding:6px 11px; border-radius:999px; border:1px solid var(--border);
  background: var(--surface); cursor:pointer; font-size:12.5px; font-weight:600;
  color: var(--text-2); position: relative;
}
.chip.is-on { background: var(--accent-sub); border-color: var(--accent); color: var(--accent); }

/* 손가락이 닿는 넓이를 넓힙니다.
   칩은 보기엔 31px 인데, 손가락 끝은 그보다 훨씬 굵습니다. 모양을
   키우면 화면이 답답해지니 안 보이는 판을 덧대서 실제로 누를 수 있는
   범위만 넓힙니다. 세로 45px, 가로 +8px.
   마우스에는 필요 없으니 터치 기기에서만 켭니다. */
@media (pointer: coarse) {
  .chip::after, .tabbar__item::after, .btn--sm::after {
    content:''; position:absolute; left:-4px; right:-4px; top:-7px; bottom:-7px;
  }
  .btn--sm { position: relative; }
  /* 칩이 촘촘히 붙어 있으면 넓힌 판끼리 겹쳐서 옆 것이 눌립니다 */
  .chips { gap: 10px; }
}

.radio-cards { display:grid; gap:8px; }
.radio-card {
  display:flex; gap:10px; align-items:flex-start; padding:11px 13px;
  border:1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor:pointer; position:relative;
}
.radio-card.is-on { border-color: var(--accent); background: var(--accent-sub); }
.radio-card__t { font-weight:700; font-size:13.5px; }
.radio-card__d { font-size:11.5px; color: var(--text-3); }

/* --- 지표 --------------------------------------------------------------- */
.stats { display:grid; grid-template-columns: repeat(auto-fit, minmax(72px,1fr)); gap:10px; }
.stat { position: relative; }
.stat__k { font-size:11px; color: var(--text-3); font-weight:600; }
.stat__v { font-size:20px; font-weight:800; font-variant-numeric: tabular-nums; letter-spacing:-.02em; }
.stat__u { font-size:11px; font-weight:600; color: var(--text-3); margin-left:2px; }
.stat__d { font-size:11px; font-weight:700; }
.stat__d.up { color: var(--muscle); } .stat__d.down { color: var(--fat); }
.stat--fat .stat__v { color: var(--fat); }
.stat--muscle .stat__v { color: var(--muscle); }

.badge {
  display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:999px;
  font-size:11px; font-weight:700; background: var(--surface-2); color: var(--text-2);
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--accent { background: var(--accent-sub); color: var(--accent); }

.note {
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px;
  border:1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  margin-bottom: 10px; position:relative;
}
.note--ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.note--warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.note--bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }
.note b { font-weight:800; }

.kv { display:flex; justify-content:space-between; gap:10px; padding:7px 0;
  border-bottom:1px solid var(--border); font-size:13px; }
.kv:last-child { border-bottom:none; }
.kv__k { color: var(--text-2); }
.kv__v { font-weight:700; font-variant-numeric: tabular-nums; }

.table { width:100%; border-collapse: collapse; font-size:12.5px; }
.table th, .table td { padding:7px 6px; text-align:left; border-bottom:1px solid var(--border); }
.table th { font-size:11px; color: var(--text-3); font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
.table td.num, .table th.num { text-align:right; font-variant-numeric: tabular-nums; }

/* --- 탭 ----------------------------------------------------------------- */
.tabs { display:flex; gap:4px; background: var(--surface-2); padding:4px;
  border-radius: var(--radius-sm); margin-bottom: 14px; }
.tabs__item { flex:1; padding:8px 6px; border:none; background:none; cursor:pointer;
  border-radius: 7px; font-weight:700; font-size:13px; color: var(--text-3); position:relative; }
.tabs__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabpane { display:none; } .tabpane.is-active { display:block; }

/* --- 모달 --------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset:0; z-index: 200; background: rgba(10,12,18,.45);
  display:flex; align-items:flex-end; justify-content:center; padding: 0;
  animation: fade .15s ease;
}
@media (min-width: 520px) { .modal-backdrop { align-items:center; padding:20px; } }
.modal {
  background: var(--surface); width:100%; max-width: var(--maxw);
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y:auto; position:relative;
  box-shadow: 0 -8px 40px rgba(0,0,0,.25);
}
@media (min-width: 520px) { .modal { border-radius: 18px; } }
.modal__head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:10px; }
.modal__title { font-size:16px; font-weight:800; }
.modal__body { font-size:13.5px; color: var(--text-2); }
.modal__actions { display:flex; gap:8px; margin-top:16px; flex-wrap:wrap; }
.modal__actions > .btn { flex:1; min-width: 100px; }

/* --- 토스트 -------------------------------------------------------------- */
#toast-host {
  position: fixed; left:50%; transform: translateX(-50%); bottom: 86px;
  z-index: 300; display:flex; flex-direction:column; gap:8px; align-items:center;
  pointer-events:none; width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: #1f2430; color:#fff; padding:10px 14px; border-radius:10px;
  font-size:12.5px; font-weight:600; box-shadow: 0 6px 24px rgba(0,0,0,.28);
  animation: toastIn .2s ease; position: relative; pointer-events:auto;
}
.toast.is-out { opacity:0; transition: opacity .3s; }
@keyframes toastIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }

/* --- 빈 상태 / 스켈레톤 --------------------------------------------------- */
.empty { text-align:center; padding: 34px 16px; color: var(--text-3); position:relative; }
.empty__ico { font-size: 32px; margin-bottom: 8px; }
.empty__t { font-weight:700; color: var(--text-2); margin-bottom:4px; font-size:14px; }
.empty__d { font-size:12.5px; margin-bottom:14px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.progress-steps { display:grid; gap:8px; margin: 14px 0; }
.pstep { display:flex; align-items:center; gap:9px; font-size:13px; color: var(--text-3); }
.pstep__dot { width:18px; height:18px; border-radius:50%; border:2px solid var(--border);
  display:grid; place-items:center; font-size:10px; flex:none; }
.pstep.is-done { color: var(--text); } .pstep.is-done .pstep__dot { background: var(--ok); border-color: var(--ok); color:#fff; }
.pstep.is-active .pstep__dot { border-color: var(--accent); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height:6px; background: var(--surface-2); border-radius:999px; overflow:hidden; }
.bar__fill { height:100%; background: var(--accent); border-radius:999px; transition: width .3s; }
.bar--fat .bar__fill { background: var(--fat); }
.bar--muscle .bar__fill { background: var(--muscle); }
.bar--weight .bar__fill { background: var(--text-2); }

/* 구간 막대 — 값 하나가 아니라 "이 사이 어딘가" 를 나타냅니다.
   측정 오차보다 작은 변화는 몇 퍼센트인지 말할 수 없습니다. 0% 도
   44% 도 아니고, 구간입니다. 채우는 대신 빗금 띠를 그 구간에 놓습니다 —
   가득 찬 막대와 눈에 띄게 달라야 "잴 수 없음" 으로 읽힙니다. */
.bar__band {
  position:absolute; top:0; bottom:0; border-radius:999px; opacity:.55;
  background: repeating-linear-gradient(135deg,
    var(--text-3) 0 3px, transparent 3px 6px);
}
.bar--fat .bar__band { background: repeating-linear-gradient(135deg,
  var(--fat) 0 3px, transparent 3px 6px); }
.bar--muscle .bar__band { background: repeating-linear-gradient(135deg,
  var(--muscle) 0 3px, transparent 3px 6px); }
.bar--range { position:relative; }

.dot-conf { width:7px; height:7px; border-radius:50%; flex:none; display:inline-block; }
.dot-conf.hi { background: var(--ok); } .dot-conf.mid { background: var(--warn); } .dot-conf.lo { background: var(--bad); }
/* 검산 상태. OCR 신뢰도 점수가 아니라 "다른 칸과 맞아떨어지는가" 입니다 —
   맞은 값에 14점, 틀린 값에 39점을 주던 신뢰도를 대신합니다. */
.dot-conf.ck-ok { background: var(--ok); }
.dot-conf.ck-none { background: var(--border); box-shadow: inset 0 0 0 1px var(--text-3); }
.dot-conf.ck-bad { background: var(--bad); }

hr.sep { border:none; border-top:1px solid var(--border); margin:14px 0; }
.muted { color: var(--text-3); font-size:12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* --- 주간 운동 칸 --------------------------------------------------------
   일곱 칸이 한 줄에 들어가야 합니다. 두 줄로 접히면 "이번 주"가 아니라
   그냥 목록이 되고, 한눈에 보는 의미가 사라집니다. 가장 좁은 폰(320px)
   에서도 칸 하나가 38px 은 되도록 gap 을 작게 잡았습니다. */
.wk { display:grid; grid-template-columns: repeat(7, 1fr); gap:4px; }
.wk__d {
  border:1px solid var(--border); border-radius:10px; background: var(--surface);
  padding:7px 0 6px; cursor:pointer; display:grid; gap:3px; justify-items:center;
  font: inherit; color: inherit; min-height:56px; align-content:center;
}
.wk__d:hover { background: var(--surface-2); }
.wk__d:active { transform: translateY(1px); }
.wk__dow { font-size:10.5px; font-weight:700; color: var(--text-3); }
.wk__num { font-size:14px; font-weight:800; font-variant-numeric: tabular-nums; line-height:1; }
.wk__d.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.wk__d.is-today .wk__dow { color: var(--accent); }
/* 계획이 없는 날은 흐리게 — 비어 있다는 것이 한눈에 보여야 합니다 */
.wk__d.is-rest { opacity:.5; }
/* 지나갔는데 못 한 날. 빨간색을 쓰지 않습니다 — 홈 화면에서 매일 보는
   빨간 칸은 독려가 아니라 매일 하는 비난입니다. 점선으로만 구분합니다. */
.wk__d.is-missed { border-style: dashed; }
.wk__marks { display:flex; gap:3px; min-height:9px; align-items:center; }
.wk__m { width:8px; height:8px; border-radius:3px; border:1.5px solid var(--muscle); }
.wk__m--cardio { border-color: var(--fat); }
.wk__m.is-done { background: var(--muscle); }
.wk__m--cardio.is-done { background: var(--fat); }

/* --- 스트릭 -------------------------------------------------------------- */
.streaks { display:grid; grid-template-columns: 1fr 1fr; gap:8px; margin-top:12px;
  padding-top:12px; border-top:1px solid var(--border); }
.streak { display:grid; grid-template-columns: auto 1fr; align-items:center; gap:8px;
  padding:8px 10px; border:1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); }
.streak.is-on { border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-sub); }
.streak__ico { font-size:17px; line-height:1; }
/* 글자가 접히면 "운동 연 / 속" 처럼 잘려 보입니다. 좁은 폰에서 두 칸이
   나란히 서므로 한 칸이 150px 밑으로 내려갑니다 — 줄바꿈 대신 말줄임. */
.streak__body { min-width:0; }
.streak__v { font-size:14px; font-weight:800; font-variant-numeric: tabular-nums;
  white-space:nowrap; line-height:1.25; }
.streak.is-on .streak__v { color: var(--accent); }
.streak__k { font-size:11px; color: var(--text-3); font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* 아주 좁은 폰(320px)에서는 두 칸이 나란히 서면 "운동 · 오늘 남…" 으로
   잘립니다. 잘린 설명은 없는 설명이므로 그 폭에서는 한 줄에 하나씩 놓습니다. */
@media (max-width: 359px) { .streaks { grid-template-columns: 1fr; } }

/* --- 하루 정하기 (M51) --------------------------------------------------- */
.daypick { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.daypick__main { flex:1; display:flex; align-items:center; gap:9px; text-align:left;
  padding:11px 12px; border:1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor:pointer; font: inherit; color: var(--text); }
.daypick__main:hover { background: var(--surface-2); }
.daypick.is-on .daypick__main { border-color: var(--accent); background: var(--accent-sub); }
.daypick__ico { font-size:17px; line-height:1; }
.daypick__t { font-weight:700; font-size:13.5px; }
.daypick__s { margin-left:auto; font-size:11.5px; color: var(--text-3); font-weight:600; }
.daypick.is-on .daypick__s { color: var(--accent); }

/* --- 프로필 사진 ---------------------------------------------------------- */
.avatar {
  flex:none; border-radius:50%; overflow:hidden; display:grid; place-items:center;
  font-weight:800; line-height:1; user-select:none;
  background: var(--surface-2); color: var(--text-2);
  border:1px solid var(--border);
}
.avatar__img { width:100%; height:100%; object-fit:cover; display:block; }
/* 사진이 없을 때. 색상(H)은 그 사람 id 에서 뽑아 고정합니다 — 같은 사람은
   언제나 같은 색이라, 목록에서 이름을 읽기 전에 눈이 먼저 찾습니다. */
.avatar--letter {
  background: hsl(var(--av-h) 62% 92%);
  color: hsl(var(--av-h) 55% 30%);
  border-color: hsl(var(--av-h) 45% 82%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar--letter {
    background: hsl(var(--av-h) 32% 24%);
    color: hsl(var(--av-h) 70% 80%);
    border-color: hsl(var(--av-h) 30% 34%);
  }
}
:root[data-theme="dark"] .avatar--letter {
  background: hsl(var(--av-h) 32% 24%);
  color: hsl(var(--av-h) 70% 80%);
  border-color: hsl(var(--av-h) 30% 34%);
}
