/* 하루식단 — 공통 스타일 (사용자 앱 + 관리자) */
/* 토큰: iOS 27 의 색 체계(시스템 그룹 배경·채움색)를 따르고, 글꼴은 Pretendard 를 유지한다 */
:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;

  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .07);
  --ink: #111114;
  --muted: #6c6c72;
  --line: rgba(60, 60, 67, .16);
  --brand: #17803a;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, #17803a 12%, #fff);
  --brand-deep: #17803a;
  --carb: #ff9500;
  --protein: #007aff;
  --fat: #ff3b30;
  --water: #32ade6;
  --danger: #d70015;
  --danger-soft: color-mix(in srgb, #d70015 9%, #fff);
  --warn-soft: color-mix(in srgb, #ff9500 15%, #fff);
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --radius: 22px;
  --radius-sm: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);

  /* Liquid Glass (iOS 27 재조정): 떠 있는 층(탭바·시트·바구니 바·토스트)에만 쓴다. 투명도는 마이 화면에서 조절 */
  --glass-a: .62;
  --glass-base: #ffffff;
  --glass-blur: blur(28px) saturate(1.8);
  --glass-edge: 0 0 0 .5px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -.5px 0 rgba(255, 255, 255, .35);
  --glass-lift: 0 12px 34px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .07);
}
:root[data-glass="clear"] { --glass-a: .32; }
:root[data-glass="regular"] { --glass-a: .62; }
:root[data-glass="tinted"] { --glass-a: .9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --fill: rgba(120, 120, 128, .28); --fill-2: rgba(120, 120, 128, .16);
    --ink: #f5f5f7; --muted: #9a9aa1; --line: rgba(84, 84, 88, .6);
    --brand: #30d158; --brand-ink: #00200b; --brand-soft: color-mix(in srgb, #30d158 18%, #1c1c1e); --brand-deep: #4be074;
    --carb: #ff9f0a; --protein: #0a84ff; --fat: #ff453a; --water: #64d2ff;
    --danger: #ff453a; --danger-soft: color-mix(in srgb, #ff453a 18%, #1c1c1e); --warn-soft: color-mix(in srgb, #ff9f0a 18%, #1c1c1e);
    --shadow: none;
    --glass-base: #1c1c1e;
    --glass-edge: 0 0 0 .5px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 .5px rgba(255, 255, 255, .08);
    --glass-lift: 0 14px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { :root { --glass-a: 1 !important; } }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) { :root { --glass-a: 1 !important; --glass-blur: none; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.3; letter-spacing: -.02em; }
h2 { font-size: 17px; letter-spacing: -.01em; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ───────── 앱 셸: 모바일(하단 탭) → 태블릿(좌측 레일) → 데스크톱(사이드바) ───────── */
.app { min-height: 100dvh; }
.main { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 720px; margin: 0 auto; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-brand { display: none; }
.nav-item {
  -webkit-touch-callout: none; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 100%; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; background: none; border: 0;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item[aria-current="page"] { color: var(--brand-deep); }
.nav-fab { position: relative; }
.nav-fab .fab {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(42, 157, 106, .45);
}
.nav-fab .fab svg { width: 28px; height: 28px; }
.nav-fab span.lbl { margin-top: 30px; }
.nav-foot { display: none; }

@media (min-width: 768px) {
  .app { display: grid; grid-template-columns: 76px 1fr; }
  .nav {
    position: sticky; top: 0; height: 100dvh; width: 76px; grid-template-columns: 1fr; align-content: start;
    grid-auto-rows: 64px; padding: 12px 0; border-top: 0; border-right: 1px solid var(--line); gap: 4px;
  }
  .nav-brand { display: grid; place-items: center; height: 48px; margin-bottom: 8px; color: var(--brand-deep); }
  .nav-brand svg { width: 30px; height: 30px; }
  .nav-brand span { display: none; }
  .nav-fab .fab { position: static; transform: none; width: 44px; height: 44px; box-shadow: none; margin-bottom: 2px; }
  .nav-fab .fab svg { width: 24px; height: 24px; }
  .nav-fab span.lbl { margin-top: 0; }
  .nav-foot { display: none; }
  .main { padding: 24px 28px 40px; max-width: 980px; }
}
@media (min-width: 1200px) {
  .app { grid-template-columns: 248px 1fr; }
  .nav { width: 248px; padding: 20px 14px; grid-auto-rows: 48px; }
  .nav-brand { display: flex; justify-content: flex-start; gap: 10px; padding: 0 10px; font-weight: 700; font-size: 19px; height: 52px; margin-bottom: 10px; color: var(--ink); }
  .nav-brand svg { color: var(--brand); }
  .nav-brand span { display: inline; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item[aria-current="page"] { background: var(--brand-soft); }
  .nav-fab .fab { width: 32px; height: 32px; margin: 0; }
  .nav-fab .fab svg { width: 20px; height: 20px; }
  .nav-fab { background: var(--brand); color: var(--brand-ink); }
  .nav-fab:hover { background: var(--brand-deep) !important; }
  .nav-fab .fab { background: transparent; }
  .nav-fab[aria-current="page"] { background: var(--brand); }
  .main { max-width: 1120px; padding: 32px 40px 56px; }
}

/* 페이지 헤더 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.date-nav { display: flex; align-items: center; gap: 4px; }
.date-nav .label { min-width: 120px; text-align: center; font-weight: 700; font-size: 17px; }

/* ───────── 컴포넌트 ───────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.ic { width: 18px; height: 18px; flex: none; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-deep); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 16px;
}
textarea.input { min-height: 90px; resize: vertical; }
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
input[type="date"].input { min-height: 46px; appearance: none; -webkit-appearance: none; text-align: left; }
input[type="date"].input::-webkit-date-and-time-value { text-align: left; }
.input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px;
}
.chip[aria-pressed="true"], .chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--brand-soft); color: var(--brand-deep); }
.badge.warn { background: var(--warn-soft); color: #9a6a00; }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: 13px; }
.notice.info { background: var(--brand-soft); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .big { font-size: 34px; margin-bottom: 6px; }

/* 리스트 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .name { font-weight: 600; }
.list .sub { font-size: 13px; color: var(--muted); }
.list .kcal { font-weight: 700; white-space: nowrap; }
.list button.row-btn { all: unset; display: flex; flex: 1; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }

/* 요약 링 + 영양소 바 */
.ring-wrap { display: grid; grid-template-columns: 148px 1fr; gap: 16px; align-items: center; }
.ring { position: relative; width: 148px; height: 148px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 13; stroke-linecap: round; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: var(--brand); transition: stroke-dashoffset .5s ease; }
.ring.over .bar { stroke: var(--danger); }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center b { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; }
.ring .center span { font-size: 12px; color: var(--muted); }
.macro { margin-bottom: 10px; }
.macro:last-child { margin-bottom: 0; }
.macro .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.macro .top b { font-weight: 700; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

/* 홈 레이아웃: 모바일 1열 → 데스크톱 2열(기록 | 요약·코치 고정) */
.home-grid { display: grid; gap: 14px; }
/* 모바일: 요약 → 코치 → 끼니 → 수분·체중 순. 데스크톱: 왼쪽 끼니 / 오른쪽 고정 패널 */
.home-side { display: contents; }
.home-side > :nth-child(1) { order: 0; }
.home-side > :nth-child(2) { order: 1; }
.home-grid > .stack { order: 2; }
.home-side > :nth-child(3) { order: 3; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 20px; }
  .home-side { display: grid; gap: 14px; align-content: start; position: sticky; top: 24px; order: 1; }
  .home-grid > .stack { order: 0; }
  .home-side .ring-wrap { grid-template-columns: 1fr; justify-items: center; }
  .home-side .ring-wrap > div:last-child { width: 100%; }
  .home-side .quick { grid-template-columns: 1fr; }
}
.meal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.meal-head h2 { display: flex; align-items: center; gap: 8px; }
.meal-head .tot { font-weight: 700; color: var(--muted); font-size: 14px; }

.coach-card .msg { white-space: pre-line; font-size: 15px; }
.coach-card .who { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--brand-deep); margin-bottom: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.avatar svg { width: 16px; height: 16px; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick .tile { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.quick .tile .v { font-size: 20px; font-weight: 700; }
.quick .tile .row { gap: 6px; flex-wrap: wrap; }
.quick .btn.sm { padding: 0 10px; }

/* 바텀시트 / 모달 */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10, 20, 14, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .2s; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -8px auto 14px; }
@media (min-width: 768px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 22px; max-height: 88dvh; padding-bottom: 20px; }
  .sheet .grab { display: none; }
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 20px; font-weight: 700; line-height: 1; }
.stepper input { width: 70px; text-align: center; font-weight: 700; font-size: 20px; border: 0; background: transparent; }

.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 80; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 768px) { .toast-host { bottom: 24px; } }
.toast { background: #1b2620; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); animation: up .2s; max-width: 420px; }
.toast.error { background: var(--danger); }

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* 기록 추가 */
.add-tabs { margin: 4px 0 14px; }
.photo-preview { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.photo-preview { display: grid; place-items: center; min-height: 120px; }
.photo-stage { position: relative; max-width: 100%; }
.photo-preview img { display: block; max-width: 100%; max-height: 300px; width: auto; height: auto; }
@media (max-width: 999px) { .photo-preview img { max-height: 42vh; } } /* 모바일: 결과(칼로리)가 사진 아래에서 바로 보이게 */
.photo-tags { position: absolute; inset: 0; pointer-events: none; }
.photo-tag { position: absolute; transform: translate(-50%, -50%); max-width: 46%; padding: 3px 9px 3px 20px; border-radius: 999px; background: rgba(255,255,255,.92); color: #111; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.photo-tag::before { content: ""; position: absolute; left: 7px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--brand); }
.photo-preview .busy { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; display: grid; place-content: center; justify-items: center; gap: 10px; }
.basket { scroll-margin-top: 12px; }
.basket-bar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 16px; background: var(--ink); color: var(--bg); border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 700; }
.basket-bar .btn { min-height: 38px; background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
@media (min-width: 768px) { .basket-bar { left: auto; right: 24px; bottom: 20px; width: 360px; } }
@media (min-width: 1000px) { .basket-bar { display: none; } }
.conf { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.conf.hi { background: var(--brand-soft); color: var(--brand-deep); }
.conf.mid { background: var(--warn-soft); color: #9a6a00; }
.conf.lo { background: var(--danger-soft); color: var(--danger); }
.add-layout { display: grid; gap: 14px; }
@media (min-width: 1000px) { .add-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .add-layout .basket { position: sticky; top: 24px; } }

/* 통계 / 차트 */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.tile-stat .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.tile-stat .l { font-size: 12px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 12px; fill: var(--muted); font-family: var(--font); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.stats-grid { display: grid; gap: 14px; }
@media (min-width: 900px) { .stats-grid { grid-template-columns: 1fr 1fr; } .stats-grid .wide { grid-column: 1 / -1; } }

/* 코치 채팅 */
.chat { display: grid; gap: 10px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; white-space: pre-line; }
.bubble.me { justify-self: end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.bubble.coach { justify-self: start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); display: flex; gap: 8px; background: var(--bg); padding-top: 8px; }
@media (min-width: 768px) { .chat-input { bottom: 12px; } }
.coach-layout { display: grid; gap: 14px; }
@media (min-width: 1000px) { .coach-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }

/* 인증 화면 */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 26px; margin-bottom: 6px; }
.auth-logo svg { width: 34px; height: 34px; color: var(--brand); }

/* 온보딩 */
.wizard { max-width: 520px; margin: 0 auto; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { flex: 1; height: 5px; border-radius: 5px; background: var(--line); }
.steps i.on { background: var(--brand); }
.choice { display: grid; gap: 10px; }
.choice button { text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.choice button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.choice b { display: block; }
.choice span { font-size: 13px; color: var(--muted); }
.result-big { font-size: 40px; font-weight: 700; letter-spacing: -.03em; color: var(--brand-deep); }

/* ───────── 관리자 ───────── */
.admin-main { max-width: 1240px; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.tbl td.wrap { white-space: normal; min-width: 220px; }
table.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.r, table.tbl th.r { text-align: right; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.photo-grid .ph { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.photo-grid .meta { padding: 10px; font-size: 12px; display: grid; gap: 4px; }
.pager-u { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.pager-u .btn { min-width: 84px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { max-width: 280px; min-height: 40px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.switch:first-of-type { border-top: 0; }
.switch input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--brand); }
@media (max-width: 767px) {
  .form-grid { grid-template-columns: 1fr; }
  .ring-wrap { grid-template-columns: 124px 1fr; gap: 12px; }
  .ring { width: 124px; height: 124px; }
  .ring .center b { font-size: 23px; }
  .tiles { grid-template-columns: 1fr 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 관리자 상단바 */
.admin-bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-bar .inner { max-width: 1240px; margin: 0 auto; padding: 10px 16px 0; }
.admin-bar .top { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding-bottom: 8px; }
.admin-bar .top svg { width: 24px; height: 24px; color: var(--brand); }
.admin-bar nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.admin-bar nav a { display: flex; align-items: center; gap: 6px; padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.admin-bar nav a svg { width: 18px; height: 18px; }
.admin-bar nav a[aria-current="page"] { color: var(--brand-deep); border-bottom-color: var(--brand); }
.admin-wrap { max-width: 1240px; margin: 0 auto; padding: 20px 16px 48px; }
@media (min-width: 768px) { .admin-wrap { padding: 28px 28px 56px; } .admin-bar .inner { padding: 12px 28px 0; } }

/* ═══════════ v2 — 정렬 보정 + 2026 트렌드 마감 (색상 토큰은 그대로) ═══════════ */
/* 빈 화면에서 본문이 내용 폭으로 쪼그라드는 버그 수정: grid item + margin:auto 는 shrink-wrap 된다 */
.main { width: 100%; min-width: 0; }
.main { animation: fade .25s var(--ease) both; }

h1 { font-size: 24px; letter-spacing: -.028em; }
h2 { font-size: 18px; letter-spacing: -.018em; }
.page-head { margin-bottom: 18px; gap: 12px; }
.stack-sm { display: grid; gap: 8px; justify-items: start; }

/* 카드 · 버튼 */
.card { border-radius: var(--radius); padding: 18px; }
.btn { border-radius: 14px; font-weight: 650; transition: transform .12s var(--ease), background-color .15s, border-color .15s, box-shadow .15s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn.primary:hover { filter: brightness(.92); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-deep); box-shadow: none; }
.btn.soft:hover { background: color-mix(in srgb, var(--brand-soft) 78%, var(--brand) 22%); }
.btn.sm { border-radius: 12px; }
.icon-btn { border-radius: 50%; }

/* 입력: 채움형 + 포커스 링 */
.input { background-color: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.input:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.input:focus { outline: none; background-color: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px; background-repeat: no-repeat; background-position: right 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366746b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
/* 날짜 입력: 어디를 눌러도 달력이 열린다 */
input[type="date"].input { position: relative; padding-right: 46px; background-repeat: no-repeat; background-position: right 14px center; min-height: 46px; text-align: left;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2366746b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E"); }
input[type="date"].input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.datebtn { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .12s var(--ease); white-space: nowrap; }
.datebtn .ic { color: var(--brand-deep); }
.datebtn:hover { border-color: var(--brand); }
.datebtn:active { transform: scale(.98); }
.datebtn:focus-within { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.datebtn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; font-size: 16px; z-index: 1; }
.datebtn input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-nav { gap: 8px; justify-content: center; }
.date-nav .icon-btn { background: var(--surface); border: 1px solid var(--line); }
.date-nav .icon-btn[disabled] { opacity: .35; }

/* 세그먼트 · 칩 */
.seg { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { border-radius: 11px; min-height: 38px; transition: background-color .15s, color .15s; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chip { transition: background-color .15s, border-color .15s, color .15s, transform .12s var(--ease); }
.chip:active { transform: scale(.96); }

/* 하단 탭바: 모바일은 떠 있는 유리 알약형 */
@media (max-width: 767px) {
  :root { --nav-h: 80px; }
  .nav { left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); height: 66px; padding: 0 6px; border: 1px solid var(--line); border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 80%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); box-shadow: 0 14px 34px rgba(8, 18, 12, .2); }
  .main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 28px); }
}

/* 끼니 카드 · 목록 · 빈 상태 */
.meal-head { gap: 12px; margin-bottom: 4px; }
.meal-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.meal-title h2 { display: block; }
.meal-title .tot { font-size: 14px; font-weight: 700; color: var(--muted); }
.meal-empty { color: var(--muted); font-size: 14px; padding: 8px 0 2px; }
.list > li { padding: 14px 0; }
.empty { padding: 36px 16px; }
.empty-ico { width: 60px; height: 60px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-ico .ic { width: 26px; height: 26px; }
.skeleton-page { display: grid; gap: 14px; }
.skeleton { border-radius: 16px; }

/* 차트: 실제 px 로 그려서 글자 크기가 일정 */
.chart-box { width: 100%; min-height: 200px; }
.chart { display: block; max-width: 100%; }
.chart text { font-size: 12px; font-weight: 500; }
.chart .grid-line { stroke-dasharray: 2 4; }

/* 관리자 */
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.table-wrap { border-radius: var(--radius); box-shadow: var(--shadow); }
table.tbl tbody tr { transition: background-color .12s; }
table.tbl tbody tr:hover td { background: var(--surface-2); }
.toolbar select.input { min-height: 40px; max-width: 200px; }
.tile-stat { border-radius: 16px; }
.photo-grid .ph { border-radius: 16px; }
@media (hover: hover) { .card { transition: box-shadow .2s var(--ease), transform .2s var(--ease); } }

/* v2 보정 */
.page-head.top { align-items: flex-start; }
.quick .meter { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.quick .tile { border-radius: 16px; }

/* 로고 링크 */
.brand-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 10px; }
.brand-link:hover { color: var(--brand-deep); }
a.nav-brand { text-decoration: none; color: var(--brand-deep); cursor: pointer; }
@media (min-width: 1200px) { a.nav-brand { color: var(--ink); } a.nav-brand:hover { background: var(--surface-2); } }

/* 내비 "기록": 항상 칠해진 버튼이 아니라 다른 메뉴와 같은 규칙(현재 화면일 때만 강조) + 작은 + 아이콘 */
.nav-fab .fab { color: #fff; }
@media (min-width: 768px) {
  .nav-fab { background: transparent !important; color: var(--muted); }
  .nav-fab:hover { background: var(--surface-2) !important; }
  .nav-fab .fab { width: 30px; height: 30px; margin: 0 0 2px; background: var(--brand); box-shadow: none; }
  .nav-fab .fab svg { width: 16px; height: 16px; }
  .nav-fab[aria-current="page"] { color: var(--brand-deep); }
}
@media (min-width: 1200px) {
  .nav-fab .fab { margin: 0; }
  .nav-fab[aria-current="page"] { background: var(--brand-soft) !important; }
}

/* 촬영 시작 · 결과 카드 */
.scan-modes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; margin-bottom: 12px; }
.scan-modes button { padding: 0 6px; }
.scan-start { text-align: center; padding: 22px 16px; }
.scan-ico { width: 64px; height: 64px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); }
.scan-ico svg { width: 30px; height: 30px; }
.btn.lg { min-height: 52px; font-size: 16px; }
.btn svg.ic { width: 16px; height: 16px; margin-right: 6px; }
.res-title { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.serv-val { min-width: 44px; text-align: center; font-weight: 700; font-size: 18px; }
.serv-val small { font-size: 11px; font-weight: 600; margin-left: 2px; color: var(--muted); }
.kcal-big { display: grid; justify-items: start; margin: 12px 0 10px; padding: 14px 16px; border-radius: 16px; background: var(--brand-soft); }
.kcal-big b { font-size: 38px; line-height: 1.1; color: var(--brand-deep); }
.kcal-big b small { font-size: 15px; margin-left: 3px; font-weight: 700; }
.mchips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mchip { display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 12px; }
.mchip span { color: var(--muted); }
.mchip b { font-size: 16px; }
.mchip.c { border-left: 4px solid #e9a23b; } .mchip.p { border-left: 4px solid #4b86d9; } .mchip.f { border-left: 4px solid #d96a5b; }
.dish-li { align-items: flex-start; }
.ing-list { list-style: none; margin: 6px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); display: grid; gap: 3px; font-size: 12.5px; }
.ing-list li { display: flex; justify-content: space-between; gap: 10px; }

/* 전체 화면 카메라 */
body.cam-open { overflow: hidden; }
.cam { position: fixed; inset: 0; z-index: 200; background: #000; color: #fff; display: grid; overflow: hidden; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.nocam .cam-video, .cam.nocam .cam-frame { display: none; }
.cam-frame { position: absolute; left: 50%; top: 46%; width: min(86vw, 520px); height: min(56vh, 520px); transform: translate(-50%, -50%); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); border: 2px solid rgba(255,255,255,.85); pointer-events: none; }
.cam[data-mode="barcode"] .cam-frame { height: min(24vh, 200px); }
.cam[data-mode="label"] .cam-frame { border-radius: 10px; }
.cam-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 14px 0; }
.cam-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center; }
.cam-btn[hidden] { display: none; }
.cam-btn[aria-pressed="true"] { background: #ffd54a; color: #111; }
.cam-btn svg { width: 22px; height: 22px; }
.cam-hint { position: absolute; left: 0; right: 0; top: calc(max(14px, env(safe-area-inset-top)) + 54px); margin: 0; text-align: center; font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.7); padding: 0 16px; }
.cam-msg { position: absolute; left: 16px; right: 16px; bottom: 210px; text-align: center; font-size: 14px; display: grid; gap: 10px; justify-items: center; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.cam.nocam .cam-msg { bottom: auto; top: 38%; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 14px; background: linear-gradient(transparent, rgba(0,0,0,.6) 40%); }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 0; display: grid; place-items: center; }
.cam-shutter span { width: 54px; height: 54px; border-radius: 50%; background: #fff; transition: transform .1s; }
.cam-shutter:active span { transform: scale(.88); }
.cam-shutter[hidden], .cam-manual[hidden] { display: none; }
.cam-manual { display: flex; gap: 8px; width: min(100%, 420px); }
.cam-manual .input { flex: 1; }
.cam-tabs { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; }
.cam-tab { border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(255,255,255,.16); color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }
.cam-tab[aria-selected="true"] { background: #fff; color: #111; }

/* ═══════════ v3 — iOS 27 (재조정된 Liquid Glass) × 슬롭 걷어내기 ═══════════
   원칙: ① 기본 면은 평평하게(테두리·그림자·그라디언트 없음) ② 유리는 떠 있는 층에만 ③ 숫자가 위계의 주인공
         ④ 글꼴은 Pretendard 유지, 굵기는 600/700 두 단계만 ⑤ 강조색은 한 가지 ⑥ 이모지·글로우 없음 */
body { letter-spacing: -.011em; }
.num, .kcal, .tot { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.034em; line-height: 1.2; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.024em; }
h3 { font-weight: 600; }
.ic, svg.ic { stroke-width: 1.8; }
@media (max-width: 767px) { .page-head > h1, .page-head .stack-sm h1 { font-size: 32px; letter-spacing: -.04em; } }

/* 유리: 떠 있는 층 */
.nav, .basket-bar, .toast:not(.error), .admin-bar, .sheet, .photo-tag {
  background: color-mix(in srgb, var(--glass-base) calc(var(--glass-a) * 100%), transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-edge), var(--glass-lift);
  border: 0;
}
.sheet { background: color-mix(in srgb, var(--glass-base) calc(min(1, var(--glass-a) + .3) * 100%), transparent); }
.admin-bar { box-shadow: var(--glass-edge); border-radius: 0; }
.basket-bar { color: var(--ink); }
.toast:not(.error) { color: var(--ink); }
.overlay { background: rgba(0, 0, 0, .3); }

/* 평평한 기본 면 */
.card { background: var(--surface); border: 0; box-shadow: none; border-radius: var(--radius); padding: 18px; }
@media (hover: hover) { .card { transition: none; } }
.table-wrap, .tile-stat, .photo-grid .ph { border: 0; box-shadow: none; background: var(--surface); }
.card-title h2 { font-size: 19px; }

/* 버튼: 캡슐 · 단색 */
.btn { border: 0; border-radius: 999px; background: var(--fill); color: var(--ink); font-weight: 600; min-height: 44px; padding: 0 20px; box-shadow: none;
  transition: transform .4s var(--spring), background-color .15s, filter .15s; }
.btn:hover { background: color-mix(in srgb, var(--fill) 70%, var(--ink) 8%); }
.btn:active { transform: scale(.96); transition-duration: .08s; }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.btn.primary:hover { background: var(--brand); filter: brightness(.92); }
.btn.soft { background: var(--brand-soft); color: var(--brand-deep); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--fill); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: 14px; border-radius: 999px; }
.btn.block { min-height: 50px; font-size: 17px; }
.btn.lg { min-height: 54px; font-size: 17px; }
.icon-btn { background: var(--fill); }
.date-nav .icon-btn { border: 0; background: var(--fill); }

/* 입력 · 칩 · 세그먼트 */
.input, select.input, textarea.input { background-color: var(--fill); border: 0; border-radius: 16px; min-height: 48px; }
textarea.input { min-height: 90px; }
.input:hover { background-color: color-mix(in srgb, var(--fill) 75%, var(--ink) 6%); border: 0; }
select.input { background-position: right 16px center; }
.input:focus { background-color: var(--fill); border: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 38%, transparent); }
.chip { border: 0; background: var(--fill); }
.chip[aria-pressed="true"], .chip.on { background: var(--brand); color: var(--brand-ink); border: 0; }
.seg { background: var(--fill); border: 0; border-radius: 999px; padding: 3px; }
.seg button { border-radius: 999px; min-height: 36px; font-weight: 600; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .04); }
.datebtn { border: 0; background: var(--fill); box-shadow: none; border-radius: 999px; }
.datebtn:hover { background: color-mix(in srgb, var(--fill) 70%, var(--ink) 8%); }
.badge { background: var(--fill); }
.notice { border-radius: 18px; }

/* 하단 탭바: 떠 있는 유리 캡슐, 선택 항목은 안쪽 캡슐 */
@media (max-width: 767px) {
  :root { --nav-h: 88px; }
  .nav { left: 14px; right: 14px; bottom: calc(10px + var(--safe-b)); height: 66px; padding: 5px; border-radius: 33px; grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .nav-item { position: relative; isolation: isolate; border-radius: 28px; font-size: 11px; font-weight: 600; transition: transform .4s var(--spring); }
  .nav-item:active { transform: scale(.94); }
  .nav-item[aria-current="page"] { color: var(--brand-deep); }
  .nav-item[aria-current="page"]::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 28px; background: var(--fill); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
  .nav-fab .fab { position: static; transform: none; width: 28px; height: 28px; margin-bottom: 0; background: var(--brand); color: var(--brand-ink); box-shadow: none; }
  .nav-fab .fab svg { width: 16px; height: 16px; stroke-width: 2.6; }
  .nav-fab span.lbl { margin-top: 0; }
  .main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
  .basket-bar { left: 14px; right: 14px; bottom: calc(var(--nav-h) + var(--safe-b) + 6px); border-radius: 26px; padding: 8px 8px 8px 20px; }
  .toast-host { bottom: calc(var(--nav-h) + var(--safe-b) + 10px); }
}
@media (min-width: 768px) {
  .nav { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 0; }
  .nav-item { border-radius: 14px; transition: background-color .15s; }
  .nav-item:hover { background: var(--fill-2); }
  .nav-item[aria-current="page"] { background: var(--fill); color: var(--ink); }
  .nav-fab .fab { background: var(--brand); color: var(--brand-ink); }
}
@media (min-width: 1200px) {
  .nav-brand { color: var(--ink); }
  .nav-brand svg { color: var(--brand); }
  .nav-item[aria-current="page"], .nav-fab[aria-current="page"] { background: var(--fill) !important; color: var(--ink); }
  .nav-fab { background: transparent !important; }
}

/* 시트: 큰 반경 + 유리 */
.sheet { border-radius: 32px 32px 0 0; padding: 22px 20px calc(22px + var(--safe-b)); }
.sheet .grab { background: color-mix(in srgb, var(--muted) 45%, transparent); width: 36px; height: 5px; }
@media (min-width: 768px) { .sheet { border-radius: 30px; } }
@keyframes up { from { transform: translateY(28px) scale(.985); opacity: 0; } }
.sheet { animation: up .38s var(--spring); }
.toast { border-radius: 999px; padding: 12px 20px; font-weight: 600; }
.toast.error { box-shadow: var(--glass-lift); }

/* 홈: 끼니는 카드 4장이 아니라 제목 + 묶음 목록 */
.meal { display: block; }
.meal + .meal { margin-top: 22px; }
.meal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 6px 8px; }
.meal-head h2 { display: block; }
.meal-head .tot { color: var(--muted); font-size: 15px; font-weight: 600; }
.group { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.group .list > li, .group .add-row { position: relative; padding: 13px 18px; border: 0; }
.group .list > li + li::before, .group .list + .add-row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: .5px; background: var(--line); }
.group .list > li:first-child { border: 0; }
.add-row { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--brand-deep); font-weight: 600; text-decoration: none; background: none; border: 0; font-size: 16px; }
.add-row .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; }
.add-row .plus svg { width: 15px; height: 15px; stroke-width: 2.6; }
.add-row:hover { background: var(--fill-2); }
.list .name { font-weight: 600; font-size: 16px; }
.list .kcal { font-weight: 600; font-size: 16px; }
.list .sub { font-size: 13px; }
.meal-empty { display: none; }

/* 요약 링 · 영양소: 숫자가 주인공, 선은 가늘게 */
.ring circle { stroke-width: 11; }
.ring .track { stroke: var(--fill); }
.ring .center b { font-size: 36px; font-weight: 700; letter-spacing: -.045em; }
@media (max-width: 767px) { .ring .center b { font-size: 28px; } }
.ring .center span { font-size: 13px; font-weight: 500; }
.meter { height: 6px; background: var(--fill); }
.macro .top { font-size: 14px; }
.macro .top > span:first-child::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--c, var(--muted)); }
.quick .meter { background: var(--fill); }
.quick .tile { background: var(--fill-2); border-radius: 18px; }
.quick .tile .v { font-weight: 700; letter-spacing: -.03em; }

/* 코치: 그라디언트·아바타 없이 */
.coach-card { background: var(--surface); }
.coach-card .who { color: var(--muted); font-weight: 600; }
.coach-card .who svg { width: 16px; height: 16px; color: var(--brand-deep); }
.avatar { display: none; }
.bubble.me { background: var(--brand); }
.bubble.coach { background: var(--surface); border: 0; }

/* 사진 결과: 큰 숫자 + 평평한 칩 */
.kcal-big { background: none; padding: 4px 0 0; margin: 14px 0 12px; }
.kcal-big b { font-size: 60px; line-height: 1; font-weight: 700; letter-spacing: -.055em; color: var(--ink); }
.kcal-big b small { font-size: 20px; font-weight: 600; letter-spacing: -.02em; color: var(--muted); margin-left: 4px; }
.mchip { border-left: 0 !important; background: var(--fill-2); border-radius: 18px; padding: 10px 12px; }
.mchip span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--c); vertical-align: 1px; }
.mchip.c { --c: var(--carb); } .mchip.p { --c: var(--protein); } .mchip.f { --c: var(--fat); }
.mchip b { font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.ing-list { border-left: 0; padding-left: 0; }
.ing-list li { border-top: 0; }
.serv-val { font-weight: 700; }
.scan-ico { background: var(--fill); color: var(--ink); }
.photo-preview { border-radius: var(--radius); }
.photo-tag { color: var(--ink); --glass-a: .78; padding: 4px 11px 4px 21px; }
.photo-tag::before { background: var(--brand); }
.conf { border-radius: 999px; padding: 1px 8px; }
.pager-u .btn { min-width: 88px; }

/* 카메라: 컨트롤은 어두운 유리 */
.cam-btn, .cam-tab { background: rgba(40, 40, 44, .42); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .22); }
.cam-tab[aria-selected="true"] { background: rgba(255, 255, 255, .92); color: #111; }
.cam-btn[aria-pressed="true"] { background: #ffd60a; color: #111; }
.cam-frame { border-width: 1.5px; border-color: rgba(255, 255, 255, .9); }
.cam-bottom { background: linear-gradient(transparent, rgba(0, 0, 0, .5) 50%); }

/* 관리자 */
.admin-bar nav a { border-bottom: 0; border-radius: 999px; margin: 0 2px 8px; padding: 8px 14px; }
.admin-bar nav a[aria-current="page"] { background: var(--fill); color: var(--ink); border: 0; }
table.tbl th { background: var(--fill-2); }
table.tbl td, table.tbl th { border-bottom: .5px solid var(--line); }
.table-wrap { border-radius: var(--radius); }

/* 인증 · 온보딩 */
.auth-card { padding: 26px 22px; }
.auth-logo { font-weight: 700; letter-spacing: -.035em; }
.choice button { border: 0; background: var(--fill-2); border-radius: 18px; }
.choice button[aria-pressed="true"] { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); }
.steps i { background: var(--fill); } .steps i.on { background: var(--brand); }
.result-big { font-weight: 700; color: var(--ink); letter-spacing: -.05em; }

/* 투명도 설정(마이) */
.glass-demo { position: relative; display: grid; place-items: center; height: 84px; border-radius: 20px; margin-bottom: 12px; overflow: hidden;
  background: linear-gradient(90deg, var(--carb) 0 33.4%, var(--protein) 33.4% 66.7%, var(--fat) 66.7% 100%); }
.glass-demo span { padding: 10px 22px; border-radius: 999px; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--glass-base) calc(var(--glass-a) * 100%), transparent); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-edge), var(--glass-lift); }

.stepper button { border: 0; background: var(--fill); transition: transform .4s var(--spring), background-color .15s; }
.stepper button:active { transform: scale(.9); transition-duration: .08s; }
.stepper input { border-radius: 12px; }
.stepper input:focus { outline: none; background: var(--fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 38%, transparent); }

/* 슬롭 정리: 빈 상태·로딩·카드 속 카드 */
.empty { padding: 28px 16px; color: var(--muted); }
.empty p { color: var(--muted); }
.empty .chips { margin-top: 14px; }
.skeleton { background: var(--fill); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick .tile { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.quick .tile .v { font-size: 24px; letter-spacing: -.035em; }
.auth-card { box-shadow: none; }
.auth-logo svg { width: 30px; height: 30px; }
@media (min-width: 900px) { .home-side .quick { grid-template-columns: 1fr; } }

/* ═══════════ v4 — Apple HIG(iOS 26/27) 대조 보정 ═══════════ */
/* 글자: HIG 표(Large Title 34 · Title1 28 · Title2 22 · Title3 20 · Body 17 · Callout 16 · Subhead 15 · Footnote 13 · Caption 12/11) */
body { font-size: 17px; line-height: 1.45; }
h1 { font-size: 28px; }
@media (max-width: 767px) { .page-head > h1, .page-head .stack-sm h1 { font-size: 34px; } }
h2 { font-size: 20px; }
.meal-head h2 { font-size: 22px; }
.list .name, .list .kcal { font-size: 17px; }
.list .sub { font-size: 15px; }
.input, select.input, textarea.input { font-size: 17px; }
.btn { font-size: 16px; }
.btn.sm { font-size: 15px; }
.add-row { font-size: 17px; }
.mchip span { font-size: 13px; }
.macro .top { font-size: 15px; }

/* 맑은 유리는 풍부한 배경 위에서만(HIG): 글이 많은 시트는 항상 충분히 불투명하게 */
:root[data-glass="clear"] { --glass-a: .5; }
.sheet { background: color-mix(in srgb, var(--glass-base) calc(max(.92, min(1, var(--glass-a) + .3)) * 100%), transparent); }

/* 탭바: 이동 수단이지 동작이 아니다(HIG) → "기록"도 다른 탭과 같은 모양, 색은 선택 항목에만 */
.nav-fab .fab, .nav-fab .fab svg { background: none !important; box-shadow: none !important; color: inherit; }
@media (max-width: 767px) { .nav-fab .fab { width: 24px; height: 24px; } .nav-fab .fab svg { width: 24px; height: 24px; stroke-width: 1.8; } }
@media (min-width: 768px) { .nav-fab .fab { width: 24px; height: 24px; margin: 0 0 2px; } .nav-fab .fab svg { width: 24px; height: 24px; } .nav-fab { color: var(--muted); } .nav-fab[aria-current="page"] { color: var(--ink); } }
@media (min-width: 1200px) { .nav-fab .fab { margin: 0; } }
.add-row { color: var(--ink); }

/* 스크롤 가장자리 효과(iOS 26): 떠 있는 탭바 밑으로 지나가는 글이 흐려져 읽기 쉽게 */
@media (max-width: 767px) {
  body::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 20; pointer-events: none;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), color-mix(in srgb, var(--bg) 88%, transparent) 62%); }
  body.cam-open::after { display: none; }
}

/* 터치 영역 44×44pt 이상(HIG): 보이는 크기는 그대로 두고 눌리는 영역만 넓힌다 */
.btn.sm, .chip, .icon-btn, .stepper button, .seg button, .cam-tab, .pager-u .btn { position: relative; }
.btn.sm::after, .chip::after, .icon-btn::after, .stepper button::after, .seg button::after, .cam-tab::after, .pager-u .btn::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: max(100%, 44px); transform: translateY(-50%); }
.icon-btn { width: 44px; height: 44px; }
.stepper button { width: 44px; height: 44px; }

/* 시트 손잡이: 끌 수 있는 영역을 넉넉히 */
.grab-zone { display: grid; place-items: center; height: 28px; margin: -14px -20px 4px; touch-action: none; cursor: grab; }
.grab-zone .grab { margin: 0; }
@media (min-width: 768px) { .grab-zone { display: none; } }
.sheet .grab { margin: 0; }

/* 높은 대비(Increase Contrast): 색 변형 제공 (HIG: 모든 색에 높은 대비 변형) */
@media (prefers-contrast: more) {
  :root { --muted: #3c3c43; --line: rgba(60, 60, 67, .5); --fill: rgba(120, 120, 128, .22); --brand: #0e5c26; --brand-deep: #0e5c26; --danger: #a50011; }
  .btn:not(.primary):not(.ghost), .input, .chip { box-shadow: inset 0 0 0 1px var(--line); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --muted: #d1d1d6; --line: rgba(235, 235, 245, .5); --brand: #4be074; --brand-deep: #4be074; --danger: #ff6961; }
}
