/* Caldiary 식단 일지 — Liquid Glass(반투명 유리 카드·흐림·빛 반사).
   이전 디자인에서 남긴 것: 녹색 강조색, 숫자 JetBrains Mono, 카드·KPI·달력 배치.
   단지탄 색(단백질 빨강·지방 노랑·탄수화물 파랑)은 식단 기록의 확정 요구라 유지한다. */
:root {
  --font-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-number: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --font-heading: "Gowun Batang", "Pretendard Variable", serif;   /* 카드 제목(아침·점심·한 달 기록): 몸 화면 제목과 같은 명조 */
  --bg: #E9EFEB;
  --ink: #13201B; --ink-2: #4E5B55; --muted: #6E7A74;
  --accent: #2F6B55; --accent-strong: #24564A; --on-accent: #FFFFFF; --accent-tint: rgba(47,107,85,.14);
  --warm: #B3611E; --goal: #8A5A12; --goal-tint: rgba(226,170,90,.22);
  --glass: rgba(255,255,255,.52); --glass-strong: rgba(255,255,255,.72); --glass-line: rgba(255,255,255,.75);
  --glass-content: rgba(255,255,255,.8);
  --surface: rgba(255,255,255,.86); --surface-line: rgba(19,32,27,.06);
  --header-glass: rgba(255,255,255,.34); --header-glass-top: rgba(255,255,255,.52);   /* 맑을수록 아래 내용의 굴절이 보인다 */
  --glass-edge: rgba(19,32,27,.08); --glass-shine: rgba(255,255,255,.9);
  --shadow: 0 1px 1px rgba(19,32,27,.04), 0 10px 30px -12px rgba(19,32,27,.22);
  --blob-1: #9ED3B6; --blob-2: #F5D8A8; --blob-3: #A9C6F0;
  --protein: #C9736B; --fat: #CFAE62; --carbs: #6F8FC6;   /* 단지탄 색: 빨·노·파 계열은 유지하고 채도만 낮춤(2026-11-26) */
  --radius: 22px; --radius-sm: 14px; --gap: 16px;
  --spring: cubic-bezier(.34,1.56,.64,1);   /* 마우스 반응: 살짝 튕기는 곡선 */
  --today: var(--ink);                       /* 머리줄 '오늘' 표시 색(빨강은 경고색이라 쓰지 않는다) */
  color-scheme: light;
}
/* 기본은 밝게: 기기·브라우저 다크 설정은 따르지 않는다(몸 탭의 말라깽이 여행이 밝은 화면뿐이라 맞춘다). ⚙ 설정의 '어둡게'만 바꾼다 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1513; --ink: #EEF3F0; --ink-2: #C3CCC8; --muted: #8E9A95;
  --accent: #7CC49B; --accent-strong: #9AD7B4; --on-accent: #0F1513; --accent-tint: rgba(124,196,155,.16);
  --warm: #E39A5E; --goal: #E7C48A; --goal-tint: rgba(231,196,138,.16);
  --glass: rgba(34,40,38,.52); --glass-strong: rgba(40,46,44,.74); --glass-line: rgba(255,255,255,.12);
  --glass-content: rgba(46,52,50,.82);
  --surface: rgba(30,36,34,.92); --surface-line: rgba(255,255,255,.08);
  --header-glass: rgba(34,40,38,.66); --header-glass-top: rgba(46,52,50,.78);
  --glass-edge: rgba(0,0,0,.35); --glass-shine: rgba(255,255,255,.16);
  --shadow: 0 1px 1px rgba(0,0,0,.3), 0 14px 34px -14px rgba(0,0,0,.7);
  --blob-1: #1F5C43; --blob-2: #5A4320; --blob-3: #243F69;
}

* { box-sizing: border-box; }
/* 화면 가장자리 여백(--gutter)과 위쪽 안전 영역(--safe-top)을 한곳에서 정한다.
   안드로이드 앱은 상태 표시줄만큼 WebView 를 이미 내려 두는데(MainActivity) WebView 가 env(safe-area-inset-top) 을 또 알려 줘
   머리줄이 한 번 더 내려오고 스크롤하면 달력과 겹쳤다(갤럭시 S25, 2026-11-26): 앱 안에서는 0 으로 둔다(app.js 가 html.in-app) */
:root { --gutter: 20px; --safe-top: env(safe-area-inset-top, 0px); --header-top: calc(var(--safe-top) + 10px); }
:root.in-app { --safe-top: 0px; }
/* 안드로이드 WebView 가 버튼을 누를 때 그리는 파란 네모를 끈다(누름은 각 버튼의 :active 로 보인다) */
html { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
.num { font-family: var(--font-number); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }

/* 유리 뒤에 비치는 색 번짐 */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.backdrop::before, .backdrop::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75; }
.backdrop::before { width: 58vmax; height: 58vmax; left: -14vmax; top: -18vmax;
  background: radial-gradient(circle at 40% 40%, var(--blob-1), transparent 65%); }
.backdrop::after { width: 52vmax; height: 52vmax; right: -16vmax; bottom: -20vmax;
  background: radial-gradient(circle at 50% 50%, var(--blob-2), transparent 62%), radial-gradient(circle at 20% 20%, var(--blob-3), transparent 55%); }

/* 카드에는 얕은 유리 면, 달력에는 더 맑은 면과 선명한 가장자리를 쓴다. */
.glass {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  box-shadow: inset 0 1px 0 var(--glass-shine), var(--shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: linear-gradient(145deg, var(--glass-strong), var(--glass));
    border-color: var(--glass-line);
    -webkit-backdrop-filter: blur(5px) saturate(125%); backdrop-filter: blur(5px) saturate(125%);
  }
  .glass.cal-card {
    background: linear-gradient(150deg, var(--glass), var(--header-glass));
    box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 -1px 0 var(--glass-edge), var(--shadow);
    -webkit-backdrop-filter: blur(13px) saturate(155%); backdrop-filter: blur(13px) saturate(155%);
  }
}
.glass-bar, .glass-dialog, .glass-circle {
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px) saturate(180%); backdrop-filter: blur(8px) saturate(180%);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 -1px 0 var(--glass-edge), var(--shadow);
}

/* ---------------- 바깥 틀·머리줄 ---------------- */
.wrap { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--gap);
  padding-block: var(--header-top) 32px;   /* 머리줄의 처음 자리 = 떠 있을 때 자리: 스크롤해도 위아래로 움직이지 않는다 */
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
/* 머리줄: [날짜 이동 | 화면 탭 | 버튼] 3칸 격자. 가운데 칸은 양옆 1fr 사이에 있어 식단·몸 어느 화면에서도 같은 자리에 있다 */
.site-header { position: sticky; top: var(--header-top); z-index: 20;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 머리줄은 바깥으로 번지는 큰 그림자 대신 아주 얇은 그림자만: 아래 카드에 마우스를 올려 화면이 다시 그려질 때 그림자가 깜빡였다 */
/* 머리줄: CSS 로는 흐림을 끄고(사파리 등은 투명도·빛 반사만), 크롬 계열에서는 liquid.js 가 약한 흐림 + 가장자리 굴절을 건다.
   예전에 큰 흐림(26px)이 아래 카드를 다시 그릴 때 초록빛 깜빡임을 냈다. 다시 생기면 liquid.js 의 머리줄 흐림을 줄인다 */
.site-header { -webkit-backdrop-filter: none; backdrop-filter: none;
  background: linear-gradient(180deg, var(--header-glass-top), var(--header-glass)); }
.day-nav { grid-column: 1; grid-row: 1; justify-self: start; display: flex; align-items: center; gap: 6px; margin-left: 4px; }
.day-label { display: inline-flex; align-items: baseline; gap: 2px; min-width: 132px; justify-content: center; white-space: nowrap; font-size: 13px; color: var(--ink-2); }
.day-label b { font-size: 15px; color: var(--ink); font-weight: 700; }
.today-badge { margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; align-self: center;
  color: var(--bg); background: var(--today); }
.day-nav input[type=date] { font: 13px var(--font-number); height: 32px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink); }
/* 식단·몸 탭: 같은 서버가 내주는 말라깽이 여행 화면(/)을 그대로 띄운다 */
/* 화면 탭: 머리줄(유리) 안에 오목하게 파인 홈, 그 위를 흰 렌즈가 미끄러진다. 두 칸 너비가 같아 렌즈 이동이 정확하다 */
.view-tabs { grid-column: 2; grid-row: 1; position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 3px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent); box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink) 10%, transparent); }
.view-tabs::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3); border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.82));
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 color-mix(in srgb, var(--ink) 6%, transparent), 0 3px 10px -3px color-mix(in srgb, var(--ink) 30%, transparent);
  transition: transform .38s var(--spring); }
.view-tabs[data-active="loss"]::before { transform: translateX(100%); }
.view-tabs[data-active="health"]::before { transform: translateX(200%); }
/* 렌즈가 옮겨 갈 때 가로로 늘었다가 출렁이며 돌아온다(app.js jiggleLens). transform 과 따로 노는 scale 속성을 써서 이동과 겹친다 */
.view-tabs.jiggle::before { animation: lens-jelly .5s cubic-bezier(.3,.7,.4,1); }
@keyframes lens-jelly { 0% { scale: 1 1; } 30% { scale: 1.22 .86; } 60% { scale: .94 1.06; } 80% { scale: 1.03 .98; } 100% { scale: 1 1; } }
.view-tab { position: relative; z-index: 1; height: 34px; min-width: 72px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: 600 14px var(--font-display); letter-spacing: -.01em; cursor: pointer; transition: color .2s ease; white-space: nowrap; }
.view-tab.active { color: var(--ink); font-weight: 700; }
:root[data-theme="dark"] .view-tabs::before { background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.12)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 3px 10px -3px rgba(0,0,0,.6); }
/* 몸 탭: 카드 틀 없이 말라깽이 여행 화면(web/body.js, Shadow DOM)을 그대로 펼친다. 모양은 web/body.css */
.body-view { padding: 0; margin-inline: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px))); }
/* 식단 탭일 때 미리 그린 몸 화면은 폭은 그대로 두고(그래프가 폭을 재서 그린다) 높이 0 으로 숨긴다(app.js initViewTabs) */
.body-view.offstage { position: absolute; left: 0; right: 0; top: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
body.view-body .day-nav, body.view-body #sync-time, body.view-body .status, body.view-body #login { display: none; }
/* 몸 탭의 머리줄 왼쪽 칸: D+ 일수와 측정 시각(몸 화면 자체 머리줄 대신). 식단 탭에서는 숨는다 */
.body-info { grid-column: 1; grid-row: 1; justify-self: start; display: none; align-items: baseline; gap: 8px; margin-left: 10px; white-space: nowrap; min-width: 0; }
body.view-body .body-info { display: inline-flex; }
.body-info b { font-size: 14px; color: var(--ink); }
.body-info span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
/* 날짜 표기: 넓은 화면은 긴 표기, 휴대폰은 짧은 표기(app.js renderDayLabel) */
.day-label .dl-short { display: none; }
.header-actions { grid-column: 3; grid-row: 1; justify-self: end; display: flex; align-items: center; gap: 6px; }
.measurement-time { font: 12px var(--font-number); color: var(--muted); white-space: nowrap; }
.status { font-size: 12px; color: var(--muted); margin: -6px 0 0 18px; }
.status:empty { display: none; }
.status.error { color: var(--warm); }

/* ---------------- 버튼 ---------------- */
button { font: inherit; cursor: pointer; }
.icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 999px;
  border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink); font-size: 16px; line-height: 1;
  box-shadow: inset 0 1px 0 var(--glass-shine); }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink-2); font-size: 13px; font-weight: 600;
  text-decoration: none; box-shadow: inset 0 1px 0 var(--glass-shine); white-space: nowrap; }
.primary-button { height: 34px; padding: 0 16px; border: 0; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--on-accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); white-space: nowrap; }
.icon-button, .chip, .primary-button { transition: transform .22s var(--spring), background-color .2s ease, box-shadow .2s ease; }
.icon-button:hover, .chip:hover, .primary-button:hover { transform: translateY(-1px); }
.icon-button:active, .chip:active, .primary-button:active { transform: scale(.96); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; transform: none; }

/* ---------------- 카드·격자 ---------------- */
.card { border-radius: var(--radius); padding: 20px; min-width: 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.col-main { grid-column: span 8; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.col-side { grid-column: span 4; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.meals-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 32px; }
.card h2 { font-family: var(--font-heading); font-size: 19px; letter-spacing: -.01em; }
/* 끼니 제목: 명조 이름 + 크고 굵은 합계 kcal. 아래 가는 선으로 기록 줄과 나눈다 */
.meal .section-head { padding-bottom: 10px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.meal-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 21px; }
.meal-total { font-family: var(--font-body); letter-spacing: 0; }
.meal-total b { font: 700 18px var(--font-number); color: var(--ink); letter-spacing: -.02em; }
.meal-total small { font: 400 12px var(--font-number); color: var(--muted); }

/* 오늘 합계 */
.hero { display: flex; flex-direction: column; gap: 18px; padding: 24px; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hero-main { display: flex; flex-direction: column; gap: 4px; }
.hero-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.hero-value { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero-value b { font: 500 clamp(44px, 7vw, 64px)/1 var(--font-number); letter-spacing: -.04em; }
.hero-value .unit { font: 15px var(--font-number); color: var(--ink-2); }
/* 단백질 계기: 섭취량 / 목표 + 채움 막대. 평소엔 차분한 녹색, 목표의 절반 미만일 때만 빨강 */
.protein-meter { display: flex; flex-direction: column; gap: 6px; min-width: 200px; max-width: 280px; flex: 0 1 260px; }
.pm-value { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-number); }
.pm-value b { font: 500 27px/1 var(--font-number); color: var(--ink); letter-spacing: -.03em; }
.pm-value span { font-size: 14px; color: var(--ink-2); }
.pm-track { height: 7px; border-radius: 999px; background: var(--accent-tint); overflow: hidden; }
.pm-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.protein-meter.low .pm-value b { color: var(--protein); }
.protein-meter.low .pm-track { background: color-mix(in srgb, var(--protein) 14%, transparent); }
.protein-meter.low .pm-track i { background: var(--protein); }
.pm-left { font: 12px var(--font-number); color: var(--muted); min-height: 1em; }
.bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--accent-tint);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.bar i { display: block; height: 100%; }
.bar i + i { box-shadow: -1px 0 0 rgba(255,255,255,.5); }
.rail-foot { display: flex; justify-content: space-between; gap: 12px; font: 12px var(--font-number); color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.rail-foot .legend { display: flex; gap: 12px; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* 식사 카드·기록 줄(모바일: 왼쪽으로 밀면 수정·삭제) */
/* 끼니 카드(기록 내용)는 더 하얗고 또렷한 유리, 합계·영양소 칸은 색이 은은하게 비치는 유리로 구분한다 */
.meal { padding: 18px 18px 10px; background: var(--glass-content); }
/* 오늘 섭취: 녹색이 비치는 유리 카드(틴티드 리퀴드 글래스). 흐림 + 가장자리 굴절(liquid.js, data-liquid) + 윗면 반사광.
   유리는 이 카드 하나만: 카드마다 흐림을 걸면 스크롤이 버벅인다(몸 탭에서 겪음) */
.hero { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 16%, rgba(255,255,255,.55)), rgba(255,255,255,.42) 62%);
  -webkit-backdrop-filter: blur(14px) saturate(170%); backdrop-filter: blur(14px) saturate(170%);
  border-color: var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 0 0 1px rgba(255,255,255,.35), inset 0 -1px 0 var(--glass-edge), var(--shadow); }
:root[data-theme="dark"] .hero { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 18%, rgba(40,46,44,.6)), rgba(34,40,38,.5) 62%); }
/* 카드 안의 작은 버튼(끼니 +, 달력 오늘·‹ ›)도 유리 알갱이처럼: 윗면 반사·아래 그늘, 누르면 쫀득하게 눌렸다 튕겨 나온다 */
.card .icon-button, .card .chip { background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.6));
  border-color: rgba(255,255,255,.9);
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 2px color-mix(in srgb, var(--ink) 6%, transparent), 0 0 0 1px color-mix(in srgb, var(--ink) 5%, transparent); }   /* 바깥 그림자 없이(아래가 잘려 보였다) */
:root[data-theme="dark"] .card .icon-button, :root[data-theme="dark"] .card .chip { background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06)); border-color: rgba(255,255,255,.14); }
.card .icon-button:active, .card .chip:active, .glass-circle:active, .header-actions .icon-button:active, .header-actions .primary-button:active { transform: scale(.86); transition-duration: .08s; }
/* 단백질·단지탄 막대도 유리관처럼: 채움 위쪽에 빛 줄 */
.pm-track i, .bar i { box-shadow: inset 0 2px 2px -1px rgba(255,255,255,.5); }   /* 막대 색은 인라인 background 라 빛 줄은 안쪽 그림자로 */
.bar i + i { box-shadow: -1px 0 0 rgba(255,255,255,.5), inset 0 2px 2px -1px rgba(255,255,255,.5); }
.entries { display: flex; flex-direction: column; }
.swipe { position: relative; overflow: hidden; border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.swipe:first-child { border-top: 0; }
/* iOS 26 의 밀기 동작처럼: 줄을 밀면 오른쪽에 둥근 유리 버튼이 떠오른다(직사각형 칸 대신) */
.swipe-actions { position: absolute; top: 0; bottom: 0; right: 0; display: flex; align-items: center; gap: 8px; padding-right: 4px; visibility: hidden; }
.swipe.open .swipe-actions, .swipe.revealing .swipe-actions { visibility: visible; }
.swipe-actions button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--glass-shine), var(--shadow); font: 600 13px var(--font-body);
  transform: scale(.6); opacity: 0; transition: transform .28s var(--spring), opacity .18s ease, width .22s var(--spring), background-color .2s ease; }
.swipe.open .swipe-actions button, .swipe.revealing .swipe-actions button { transform: none; opacity: 1; }
.swipe-actions button:nth-child(2) { transition-delay: .03s; }
.swipe-actions svg, .glass-circle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.swipe-actions .act-del { background: #E0544F; border-color: transparent; color: #fff; }
.swipe-actions .act-del.armed { width: 76px; background: #B3261E; }
.swipe-actions .act-restore { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.entry { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 11px 2px;
  background: transparent; touch-action: pan-y; transition: transform .22s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.swipe.dragging .entry { transition: none; }
.entry .name { font-weight: 600; overflow-wrap: anywhere; }
.entry .meta { font-size: 12px; color: var(--muted); grid-column: 1 / -1; }
.entry .meta .num { color: var(--ink-2); }
.entry-details { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.entry-macros { text-align: right; }
.entry-note { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .kc { text-align: right; font: 500 16px var(--font-number); white-space: nowrap; }
.entry .kc small { font-size: 11px; color: var(--muted); font-weight: 400; }
.entry.deleted .name { text-decoration: line-through; opacity: .55; }
.badge { font: 600 10px var(--font-body); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px;
  background: var(--accent-tint); color: var(--accent); }
.empty { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
/* 마우스가 있는 화면에서 수정·삭제를 항상 표시한다. */
.hover-acts { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hover-acts { display: flex; align-items: center; gap: 4px; grid-column: 1 / -1; padding: 2px 2px 1px; }
  .hover-acts .chip { height: 26px; min-width: 46px; padding: 0 8px; font-size: 12px; }
}

/* ---------------- 한 달 기록 달력 ---------------- */
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-today { height: 28px; padding: 0 8px; font-size: 12px; }
.hover-acts .chip, .cal-today, #open-add {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; line-height: 1;
  border: 1px solid var(--glass-line); background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-shine);
}
#open-add { gap: 4px; padding-inline: 9px; color: var(--ink);
  background: linear-gradient(145deg, var(--glass-shine), transparent 62%), color-mix(in srgb, var(--accent) 28%, var(--glass-strong)); }
#open-add svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.card .hover-acts .chip { color: var(--ink); background: var(--glass-content);
  border-color: color-mix(in srgb, var(--ink) 26%, transparent);
  box-shadow: inset 0 1px 0 var(--glass-shine), 0 2px 4px var(--glass-edge); }
.card .hover-acts .chip.danger { color: #A83F37; border-color: color-mix(in srgb, currentColor 38%, transparent); }
:root[data-theme="dark"] .card .hover-acts .chip { background: var(--glass-content);
  border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
:root[data-theme="dark"] .card .hover-acts .chip.danger {
  color: #F4A598; border-color: color-mix(in srgb, currentColor 42%, transparent); }
.cal-month { font-size: 13px; color: var(--ink-2); min-width: 66px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; font-weight: 600; }
.cal-dow.sun { color: var(--warm); }
.cal-day { aspect-ratio: 1; border-radius: 12px; border: 1px solid transparent; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0;
  font: 600 16px/1.05 var(--font-number); color: var(--ink); transition: transform .22s var(--spring); }
.cal-day small { font-size: 9px; font-weight: 400; opacity: .8; margin-top: 2px; }
.cal-day.pad { visibility: hidden; }
.cal-day.future { color: color-mix(in srgb, var(--muted) 45%, transparent); cursor: default; }
.cal-day.none { border: 1px dashed color-mix(in srgb, var(--muted) 50%, transparent); color: var(--muted); }
.cal-day { --day-c: var(--muted); }
.cal-day.vlow { --day-c: var(--carbs); } .cal-day.low, .cal-day.rec, .cal-day.ok { --day-c: var(--accent); }
.cal-day.over { --day-c: var(--goal); } .cal-day.vover { --day-c: var(--warm); }
.cal-day.vlow { background: color-mix(in srgb, var(--carbs) 16%, transparent); color: color-mix(in srgb, var(--carbs) 75%, var(--ink)); }
.cal-day.low { background: var(--accent-tint); color: var(--accent); }
.cal-day.ok { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.cal-day.over { background: var(--goal-tint); color: var(--goal); }
.cal-day.vover { background: var(--warm); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.cal-day.rec { background: var(--accent-tint); color: var(--accent); }
.cal-card button.cal-day:not(.ok):not(.vover) {
  background-color: color-mix(in srgb, var(--day-c) 16%, var(--glass-strong));
}
.cal-card button.cal-day.none, .cal-card button.cal-day.future {
  background-color: var(--glass-strong);
}
.cal-card button.cal-day.future { color: var(--muted); opacity: 1; }
/* 오늘: 테두리 선 대신 칸 색으로 은은하게 번지는 바깥 빛(보고 있는 날의 유리와 헷갈리지 않게, 2026-11-27) */
.cal-day.today { box-shadow: 0 0 0 1px color-mix(in srgb, var(--day-c) 30%, transparent), 0 0 14px 2px color-mix(in srgb, var(--day-c) 55%, transparent); }
.cal-day.today.none { border-color: transparent; background: rgba(255,255,255,.55); --day-c: var(--accent); }
/* 보고 있는 날: 칸 색이 비치는 유리(틴티드 리퀴드 글래스). 윗면 반사·아래 굴절 그늘·가장자리 빛이 있고 살짝 떠오른다 */
.cal-day.sel { position: relative; z-index: 1; transform: scale(1.05);   /* 과하다는 피드백으로 약하게(2026-11-27) */
  background-image: linear-gradient(170deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,0) 50%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 0 0 1.5px rgba(255,255,255,.55), 0 3px 8px -4px color-mix(in srgb, var(--day-c) 60%, transparent); }
.cal-day.sel.none { border-color: transparent; background-color: var(--glass-strong); --day-c: var(--ink-2); }
.cal-day.sel:hover { transform: scale(1.07); }
.cal-day.sel.today { box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 0 0 1.5px rgba(255,255,255,.55), 0 0 12px 2px color-mix(in srgb, var(--day-c) 45%, transparent); }
.cal-day:not(.pad):not(.future):hover { transform: scale(1.06); }
.state-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 14px; }
.state-key span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.state-key i { width: 11px; height: 11px; border-radius: 4px; display: inline-block; aspect-ratio: auto; }
.cal-stat { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: right; }
.cal-stat:empty { display: none; }

/* ---------------- 대화 상자 ---------------- */
.glass-dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100% - 48px); padding: 22px; border-radius: 26px;
  color: var(--ink); background: var(--glass-strong); }
.glass-dialog::backdrop { background: rgba(10,20,16,.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.glass-dialog[open] { animation: rise .22s cubic-bezier(.2,.8,.2,1); }
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
/* 창 머리줄(iOS 26 시트): 왼쪽 X 닫기, 가운데 제목, 오른쪽 ✓ 저장 — 모두 둥근 유리 버튼 */
.sheet-bar { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.sheet-bar h2 { text-align: center; font-size: 17px; }
.glass-circle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink);
  box-shadow: inset 0 1px 0 var(--glass-shine); transition: transform .22s var(--spring), background-color .2s ease; }
.glass-circle.confirm { border-color: transparent; color: var(--on-accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent)); }
.glass-circle:hover { transform: translateY(-1px); }
.glass-circle:active { transform: scale(.92); }
form.add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
form.add label { display: flex; flex-direction: column; font-size: 12px; gap: 3px; min-width: 0; color: var(--ink-2); font-weight: 500; }
form.add .wide { grid-column: 1 / -1; }
form.add input, form.add select { font: inherit; font-size: 14px; width: 100%; min-width: 0; height: 34px; padding: 0 10px;
  border: 1px solid var(--glass-line); border-radius: 10px; background: var(--glass); color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }
form.add .nutrients { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
/* 한 줄 두 칸(양|단위, 식사|식사일). 식사는 짧은 낱말이라 좁게 */
form.add .frow { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
form.add .frow.meal-first { grid-template-columns: 88px minmax(0, 1fr); position: relative; }
.edit-date-field { display: grid; gap: 3px; color: var(--ink-2); font-size: 12px; font-weight: 500; }
#e-day-open { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 34px;
  padding: 0 10px; border: 1px solid var(--surface-line); border-radius: 8px;
  background: var(--glass-strong); color: var(--ink); font: 500 14px var(--font-number); cursor: pointer; }
#e-day-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.edit-calendar { grid-column: 1 / -1; padding: 9px 12px 12px; border: 1px solid var(--surface-line);
  border-radius: 14px; background: var(--surface); }
.edit-calendar .cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.edit-calendar .cal-day { aspect-ratio: auto; min-height: 35px; border-radius: 8px; }
.edit-calendar .cal-day.sel { background: var(--accent); color: var(--on-accent); }
form.add .nutrients label.p { color: var(--protein); }
form.add .nutrients label.f { color: color-mix(in srgb, var(--fat) 70%, var(--ink)); }
form.add .nutrients label.c { color: var(--carbs); }
form.add > .chip.wide { height: 40px; justify-content: center; }
form.add fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
form.add legend { font-size: 12px; color: var(--ink-2); font-weight: 500; margin-bottom: 6px; padding: 0; }
form.add .switch { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
form.add .switch input { width: 20px; height: 20px; accent-color: var(--accent); box-shadow: none; }
.results { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; list-style: none; margin: 0; padding: 4px;
  max-height: min(320px, 45vh); overflow: auto; overscroll-behavior: contain; border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 94%, transparent); border: 1px solid var(--glass-line); box-shadow: 0 12px 28px -10px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
.results:empty { display: none; }
.results li { padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1.3; }
.results li + li { border-top: 1px solid var(--glass-line); }
.results li:hover, .results li:focus { background: var(--accent-tint); outline: none; }
/* 검색 후보: [출처 꼬리표] 이름 / 아래 작은 글씨. 출처마다 색이 달라 최근 기록과 식약처 공식 값이 한눈에 갈린다 */
.results li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 8px; align-items: center; }
.results .res-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results li small { white-space: nowrap; font: 11px var(--font-body); }
.results .empty-result { display: block; color: var(--muted); }
.results .src { font: 700 10px var(--font-body); padding: 2px 7px; border-radius: 999px; white-space: nowrap; align-self: center; }
.src-product { background: var(--accent-tint); color: var(--accent); }
.src-recent { background: var(--goal-tint); color: var(--goal); }
.src-company { background: color-mix(in srgb, var(--fat) 20%, transparent); color: color-mix(in srgb, var(--fat) 60%, var(--ink)); }
.src-mfds { background: color-mix(in srgb, var(--carbs) 18%, transparent); color: color-mix(in srgb, var(--carbs) 75%, var(--ink)); }
.results li small { color: var(--muted); }
.msg { grid-column: 1 / -1; font-size: 12px; margin: 0; color: var(--accent); }
.msg:empty { display: none; }
.msg.error { color: var(--warm); }
#login form { display: flex; gap: 8px; }
#login input { flex: 1; height: 38px; padding: 0 12px; border: 1px solid var(--glass-line); border-radius: 12px; background: var(--glass); color: var(--ink); }

/* ---------------- 좁은 화면 ---------------- */
@media (max-width: 900px) {
  .col-main, .col-side { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  :root { --gutter: 12px; --header-top: calc(var(--safe-top) + 8px); }
  .wrap { gap: 12px; padding-bottom: 28px; }
  /* 머리줄 한 줄: [‹ 11.26 목 › | 식단 기록·몸 기록 | ⚙ +]. 내용 위에 떠 있어 스크롤하면 유리 아래로 내용이 지나간다 */
  /* 탭은 양옆 같은 너비(1fr auto 1fr) 사이 정중앙: 식단·몸을 오가도 자리가 그대로다. 360px 폭(갤럭시 S25)에 맞게 양옆을 줄였다 */
  .site-header { padding: 5px; gap: 6px; }
  .view-tab { min-width: 0; height: 32px; padding: 0 11px; font-size: 13px; }
  .day-nav { gap: 0; margin-left: 0; min-width: 0; }
  .day-nav .icon-button { width: 22px; height: 30px; background: transparent; border-color: transparent; box-shadow: none; }
  .day-label { min-width: 0; font-size: 12px; }
  .day-label .dl-long, .day-label .today-badge { display: none; }   /* 요일·'오늘' 배지는 자리가 없어 뺀다(오늘이면 날짜가 강조색) */
  .day-label b.dl-short { display: inline; font-size: 14px; letter-spacing: -.02em; }
  .day-label.is-today b.dl-short { color: var(--accent); }
  .body-info { margin-left: 6px; flex-direction: column; gap: 0; line-height: 1.15; }
  .body-info span { font-size: 10px; }
  .header-actions { gap: 6px; }
  .header-actions .icon-button { width: 30px; height: 30px; }
  .header-actions .measurement-time, .primary-button .add-label { display: none; }
  #open-add { width: 32px; height: 32px; padding: 0; }
  .dashboard-grid { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }   /* 넓은 화면의 align-items: start 를 그대로 두면 카드가 내용 너비로 줄어든다 */
  .col-main, .col-side { display: contents; }
  .cal-card { order: 1; } .hero { order: 2; padding: 20px; } .meals-grid { order: 3; }
  .glass-dialog { width: calc(100% - 16px); max-width: none; margin: auto 8px 8px; max-height: calc(100% - 24px); border-radius: 30px; padding: 12px 14px 16px; }
  .glass-dialog[open] { animation: sheet-up .32s cubic-bezier(.2,.8,.2,1); }
  .meals-grid { grid-template-columns: 1fr; gap: 12px; }
  form.add { grid-template-columns: 1fr; gap: 7px; }
  /* 영양 다섯 칸을 한 줄에: 좁은 칸이라 이름을 작게, 숫자 칸은 안쪽 여백을 줄인다 */
  form.add .nutrients { gap: 5px; }
  form.add .nutrients label { font-size: 10.5px; gap: 4px; white-space: nowrap; }
  form.add .nutrients input { padding: 0 6px; font-size: 13px; text-align: center; }
  form.add fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-day { font-size: 15px; border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .glass-dialog[open] { animation: none; }
  .view-tabs.jiggle::before { animation: none; }
  .entry, .icon-button, .chip, .primary-button, .cal-day, .pm-track i { transition: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .glass-bar, .glass-dialog { background: var(--glass-strong); }
}
