/* กินดี Cal — ธีม Liquid Glass โทนสว่าง (มินต์ + เลมอน + พีช) และส่วนประกอบเฉพาะแอป */
:root[data-ui="light"][data-theme="1"] {
  --bg: #EAF8F0;
  --bgimg: radial-gradient(60% 45% at 12% 8%, #B8F0D2 0%, transparent 70%), radial-gradient(55% 40% at 95% 20%, #FFF1B3 0%, transparent 70%),
    radial-gradient(60% 45% at 85% 85%, #FFD9C7 0%, transparent 70%), radial-gradient(50% 40% at 10% 90%, #C9ECFF 0%, transparent 70%),
    linear-gradient(180deg, #F4FFF8, #EEF9F3);
  --accent: #10A06E; --accent-soft: #10A06E1F; --accent-line: #10A06E59; --on-accent: #fff;
  --lime: #C8F25A; --on-lime: #14301F; --ok: #12A56E; --warn: #E08A00; --danger: #E0453C;
  --ok-soft: #12A56E1F; --warn-soft: #E08A001F; --danger-soft: #E0453C1A;
  --surface: rgba(255, 255, 255, .58); --surface2: rgba(255, 255, 255, .55); --line: rgba(20, 60, 40, .08);
  --text: #0E1B14; --sub: rgba(20, 40, 30, .66); --mut: rgba(20, 40, 30, .4);
}
.seo { padding: 40px 20px; color: var(--sub); } .seo h1 { color: var(--text); font-size: 26px; margin-bottom: 8px; }
.sub { color: var(--sub); font-size: 13.5px; line-height: 1.5; }
.disc { margin: 22px 6px 8px; font-size: 12px; color: var(--mut); line-height: 1.5; text-align: center; }
.kc { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.card.flat { box-shadow: none; }
.ibtn.sm { width: 34px; height: 34px; min-height: 34px; }
.ibtn { position: relative; }
.ibtn .badge { position: absolute; top: -2px; right: -2px; }
.empty.sm { padding: 14px 8px; font-size: 14px; }
.lg-spin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: kd-spin .8s linear infinite; margin-bottom: 8px; }
@keyframes kd-spin { to { transform: rotate(360deg); } }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }

/* หัวหน้าหลัก */
.hm-hd { padding: 6px 2px 14px; display: flex; align-items: flex-start; gap: 8px; } .hm-hd-t { flex: 1; min-width: 0; }
.hm-hd h1 { font-size: 28px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-cof { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text); }
.hm-hd .ibtn { width: 40px; height: 40px; min-height: 40px; }
.hm-cf { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; }
.hm-cf .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); flex: none; }
.hm-cf .tx { flex: 1; } .hm-cf .tx b { display: block; } .hm-cf .tx span { font-size: 13px; color: var(--sub); }
.setup { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; }

/* วงแคลอรี่ */
.hero { display: flex; flex-direction: column; align-items: center; }
.ring { position: relative; width: 168px; height: 168px; }
.rg-bg { fill: none; stroke: rgba(16, 160, 110, .12); stroke-width: 14; }
.rg-fg { fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease, ease); }
.rg-fg.over { stroke: var(--danger); }
.rg-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rg-c b { font-size: 34px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rg-c span { font-size: 13px; color: var(--sub); }
.hero-s { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin: 12px 0 4px; text-align: center; }
.hero-s span { display: block; font-size: 12.5px; color: var(--sub); } .hero-s b { font-size: 18px; font-variant-numeric: tabular-nums; }
.macs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; width: 100%; margin-top: 12px; }
.mac-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 4px; }
.mac-h span { color: var(--sub); } .mac-h b { font-size: 13.5px; font-variant-numeric: tabular-nums; } .mac-h small { color: var(--sub); font-weight: 500; }

/* ปุ่มลัด */
.qa-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0 4px; }
.qa { text-align: center; color: var(--text); font-size: 12.5px; }
.qa .ibtn { width: 58px; height: 58px; border-radius: 20px; background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--hi), 0 4px 14px rgba(0, 0, 0, .06); color: var(--accent); }

/* คำแนะนำ */
.adv { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 14.5px; line-height: 1.5; border-top: 1px solid var(--line); }
.adv:first-child { border-top: 0; padding-top: 0; } .adv:last-child { padding-bottom: 0; }
.adv .dot { margin-top: 7px; background: var(--accent); } .adv .dot.warn { background: var(--warn); } .adv .dot.ok { background: var(--ok); }

/* น้ำ */
.cups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cup { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface2); color: var(--mut); }
.cup.on { background: #D6EEFF; color: #1E88E5; }

/* กราฟ 7 วัน */
.wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.wk-d { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--sub); font-size: 11.5px; }
.wk-b { position: relative; width: 100%; max-width: 30px; height: 96px; border-radius: 10px; background: var(--surface2); overflow: hidden; display: flex; align-items: flex-end; }
.wk-b i { display: block; width: 100%; background: var(--accent); border-radius: 10px 10px 4px 4px; opacity: .75; }
.wk-b i.over { background: var(--danger); }
.wk-b em { position: absolute; left: 0; right: 0; border-top: 2px dashed rgba(0, 0, 0, .28); }
.wk-d.on { color: var(--text); font-weight: 700; } .wk-d.on .wk-b i { opacity: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--hi); }
.tile .v.bad { color: var(--danger); } .tile .v .pill { font-size: 12px; vertical-align: middle; }

/* ฟอร์ม */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--sub); min-width: 0; }
.mini input, .field select, .inrow select { width: 100%; min-width: 0; }
.field select, .inrow select { min-height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); padding: 0 12px; font: inherit; font-size: 15px; }
.inrow select { flex: 1; }
.prose p { font-size: 14px; line-height: 1.6; margin: 0 0 8px; } .prose p:last-child { margin: 0; }

/* วันในสัปดาห์ (แผนออกกำลังกาย) */
.dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow button { position: relative; min-height: 46px; border-radius: 14px; background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text); box-shadow: var(--hi); }
.dow button.on { background: var(--accent); color: var(--on-accent); }
.dow button.has i { position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; opacity: .6; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who > div { background: var(--surface2); border-radius: 18px; padding: 12px; display: flex; gap: 8px; align-items: center; }
.who b { font-size: 30px; font-weight: 700; color: var(--warn); font-variant-numeric: tabular-nums; } .who .ok b { color: var(--ok); }
.who span { font-size: 12px; color: var(--sub); line-height: 1.35; }

/* รูปอาหาร */
.ph-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 16px; border-radius: 22px; border: 2px dashed var(--accent-line); background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.ph-drop b { color: var(--text); font-size: 16px; } .ph-drop span { font-size: 13px; color: var(--sub); line-height: 1.5; }
.ph-res { display: flex; gap: 14px; align-items: center; }
.ph-res img { width: 112px; height: 112px; object-fit: cover; border-radius: 18px; flex: none; }
.ph-sum { font-size: 34px; font-weight: 700; margin-top: 6px; } .ph-sum small { font-size: 15px; color: var(--sub); }
.chk { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.chk.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.qty { display: inline-flex; align-items: center; gap: 2px; background: var(--surface2); border-radius: 999px; padding: 2px; flex: none; }
.qty button { width: 30px; height: 30px; border-radius: 50%; font-size: 18px; font-weight: 600; color: var(--accent); }
.qty b { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.qty.lg button { width: 44px; height: 44px; font-size: 22px; } .qty.lg b { min-width: 48px; font-size: 20px; }
.qbox { position: fixed; inset: 0; z-index: 200; background: rgba(10, 30, 20, .28); display: grid; place-items: center; padding: 16px; }
.qbox .card { width: min(360px, 100%); text-align: center; background: rgba(255, 255, 255, .92); }
.qbox .btns { justify-content: center; }
img.li-ic { object-fit: cover; padding: 0; }
.seg button svg { vertical-align: -3px; }
@media (max-width: 360px) { .macs { grid-template-columns: 1fr; } .qa .ibtn { width: 52px; height: 52px; } }

/* ก้าวเดิน + ซิงก์ */
.steps { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: inherit; }
.steps .li-t b small { font-size: 13px; color: var(--sub); font-weight: 500; }
.steps .meter { margin-top: 6px; }
.stp { display: flex; align-items: baseline; gap: 6px; } .stp b { font-size: 36px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; } .stp span { color: var(--sub); }
.wk-b.sm { height: 56px; } .wk-b i.goal { background: var(--ok); opacity: 1; }
.cp { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--sub); }
.cp code { display: block; padding: 10px 12px; border-radius: 12px; background: var(--surface2); color: var(--text); font-size: 13px; word-break: break-all; user-select: all; }
.cp .btn { align-self: flex-start; }
.prose code { background: var(--surface2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.top .btn { flex: none; }
.wrow { display: flex; align-items: center; gap: 8px; } .wrow input { flex: 1; min-width: 0; text-align: center; font-size: 17px; } .wrow .btn { min-width: 52px; }
.cpbox { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); font-size: 12.5px; word-break: break-all; user-select: all; -webkit-user-select: all; }
details.card summary { cursor: pointer; list-style: none; } details.card summary::-webkit-details-marker { display: none; } details.card[open] summary { margin-bottom: 8px; }

/* กราฟประวัติ */
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .gx { stroke: var(--line); stroke-width: 1; }
.chart .ax { font-size: 9.5px; fill: var(--sub); font-family: var(--font); }
.chart .gl { stroke: var(--text); stroke-opacity: .45; stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .cur { stroke: var(--text); stroke-opacity: .35; stroke-width: 1; }
[data-read] { font-variant-numeric: tabular-nums; }
.tbl { max-height: 360px; overflow: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--sub); font-weight: 600; position: sticky; top: 0; background: var(--surface); }

/* ---- หน้าวันนี้แบบหลายสี: วงแหวน 3 ชั้น + สารอาหารคนละสี · kcal เผาผลาญ = ส้ม (ต่างจากที่กิน = เขียว) */
:root { --burn: #F2652E; --burn-soft: #F2652E1F; }
.burn-t { color: var(--burn); font-weight: 700; }
.hero2 { background-image: linear-gradient(135deg, rgba(61, 220, 151, .16), transparent 45%, rgba(255, 179, 71, .14)); }
.hero-top { display: flex; align-items: center; gap: 14px; width: 100%; }
.hero2 .ring { width: 164px; height: 164px; flex: none; }
.rg-a { transition: stroke-dashoffset .7s var(--ease, ease); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .12)); }
.hero2 .rg-c b { font-size: 24px; font-weight: 800; }
.legs { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.leg { display: flex; align-items: center; gap: 10px; }
.leg-i { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.leg small { display: block; font-size: 12px; color: var(--sub); }
.leg b { font-size: 19px; font-variant-numeric: tabular-nums; } .leg em { font-style: normal; font-size: 12px; color: var(--sub); }
.leg.eat .leg-i { background: linear-gradient(135deg, #3DDC97, #10A06E); } .leg.eat b { color: #10A06E; }
.leg.burn .leg-i { background: linear-gradient(135deg, #FFB347, #F2652E); } .leg.burn b { color: var(--burn); }
.leg.wat .leg-i { background: linear-gradient(135deg, #6FC8FF, #3B8FD9); } .leg.wat b { color: #3B8FD9; }
.mts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 16px; }
.mt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; background: color-mix(in srgb, var(--mc) 9%, transparent); text-align: center; }
.mt-r { position: relative; width: 46px; height: 46px; } .mt-r svg { display: block; }
.mt-r i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mt b { font-size: 13px; } .mt > span:last-child { font-size: 12.5px; font-variant-numeric: tabular-nums; } .mt small { color: var(--sub); }
.g-pk { background: linear-gradient(135deg, #FF6FA3, #E8505B) !important; } .g-pu { background: linear-gradient(135deg, #7C5CFF, #4B3FC0) !important; }
.g-or { background: linear-gradient(135deg, #F5A524, #F2652E) !important; } .g-te { background: linear-gradient(135deg, #14B8C4, #10A06E) !important; }
.g-ye { background: linear-gradient(135deg, #FFCC4D, #F5A524) !important; }
.qa .ibtn[class*="g-"] { color: #fff; border-radius: 50%; box-shadow: 0 6px 16px rgba(0, 0, 0, .14); }
.ml-i { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; margin-right: 12px; }
.wk-burn { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: linear-gradient(90deg, rgba(255, 179, 71, .16), rgba(242, 101, 46, .12)); margin-bottom: 10px; }
.wk-burn .leg-i { background: linear-gradient(135deg, #FFB347, #F2652E); width: 38px; height: 38px; }
.wk-burn small { display: block; font-size: 12px; color: var(--sub); } .wk-burn b { color: var(--burn); font-size: 19px; font-variant-numeric: tabular-nums; }
.wk-burn .r { margin-left: auto; text-align: right; } .wk-burn .r b { font-size: 15px; }
@media (max-width: 370px) { .hero-top { flex-direction: column; } }
.dow button small { display: block; font-size: 10.5px; line-height: 1.1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.dow button.on small { color: #fff; } .dow button:has(small) i { display: none; }
.card-h .burn-t { margin-left: auto; font-size: 14px; }
.hero2 .ring, .hero2 .ring svg { width: 148px; height: 148px; } .hero-top { gap: 12px; }
.leg > span:last-child { white-space: nowrap; } .leg b { font-size: 17px; } .leg-i { width: 30px; height: 30px; }
.burn-t { font-style: normal; display: inline; }

/* ---- ธีมมืด (ปุ่มดวงจันทร์/ดวงอาทิตย์มุมขวาบนหน้าแรก) */
:root[data-ui="dark"][data-theme="1"] {
  --bg: #07140F;
  --bgimg: radial-gradient(60% 45% at 10% 5%, rgba(16, 160, 110, .42) 0%, transparent 70%), radial-gradient(55% 40% at 95% 18%, rgba(124, 92, 255, .28) 0%, transparent 70%),
    radial-gradient(60% 45% at 88% 88%, rgba(242, 101, 46, .22) 0%, transparent 70%), radial-gradient(50% 40% at 8% 92%, rgba(59, 143, 217, .28) 0%, transparent 70%),
    linear-gradient(180deg, #07140F, #0A1220);
  --accent: #2FD9A4; --accent-soft: #2FD9A429; --accent-line: #2FD9A466; --on-accent: #06120D;
  --lime: #C8F25A; --on-lime: #14301F; --ok: #2FD9A4; --warn: #FFB340; --danger: #FF6B5E;
  --ok-soft: #2FD9A426; --warn-soft: #FFB34026; --danger-soft: #FF6B5E26;
  --surface: rgba(30, 44, 40, .55); --surface2: rgba(255, 255, 255, .07); --line: rgba(255, 255, 255, .1);
  --text: #EEF6F1; --sub: rgba(225, 240, 232, .68); --mut: rgba(225, 240, 232, .4); --burn: #FF8A50;
}
:root[data-ui="dark"] .hero2 { background-image: linear-gradient(135deg, rgba(61, 220, 151, .14), transparent 45%, rgba(255, 179, 71, .12)); }
:root[data-ui="dark"] .leg.eat b { color: #3DDC97; } :root[data-ui="dark"] .leg.wat b { color: #6FC8FF; }
:root[data-ui="dark"] .mt { background: color-mix(in srgb, var(--mc) 16%, transparent); }
.edg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .edg label { display: flex; flex-direction: column; gap: 4px; }
/* สารอาหารเกินเป้า (ที่ควรจำกัด): กรอบแดง + ⚠ มุมขวาบน + บอกว่าเกินเท่าไร */
.mt { position: relative; }
.mt.bad { background: color-mix(in srgb, var(--danger) 12%, transparent) !important; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 55%, transparent); }
.mt.bad > span:nth-child(3) { color: var(--danger); }
.mt-x { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--danger); }
.mt-w { position: absolute; top: 6px; right: 8px; font-size: 15px; color: var(--danger); line-height: 1; }
/* สารอาหารที่เป็นประโยชน์ (โปรตีน ใยอาหาร) ถึงเป้า: กรอบเขียว + ✓ */
.mt.good { background: color-mix(in srgb, var(--accent) 12%, transparent) !important; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.mt.good > span:nth-child(3) { color: var(--accent); }
.mt-g { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--accent); }
.mt-w.ok { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.mt-l { color: var(--sub); font-weight: 500; }
