/* =========================================================
   Placeholder Fridge  —  UI Style (สไตล์สดใหม่ โทนเขียว)
   ========================================================= */
:root {
  --g-900: #0f3d26;
  --g-800: #14532d;
  --g-700: #1f7a4d;
  --g-600: #23935b;
  --g-500: #34b06f;
  --g-100: #e3f4e9;
  --g-50:  #f2f9f4;
  --ink:   #1d2b22;
  --muted: #64756b;
  --line:  #e3ebe5;
  --card:  #ffffff;
  --bg:    #f6faf7;
  --red:   #dc2626;  --red-50: #fdecec;
  --amber: #d97706;  --amber-50: #fff5e1;
  --blue:  #2563eb;  --blue-50: #e8f0ff;
  --pink:  #db2777;  --pink-50: #fde9f2;
  --orange:#ea580c;  --orange-50:#fff0e5;
  --yellow:#ca8a04;  --yellow-50:#fdf7dc;
  --gray:  #6b7280;  --gray-50: #f1f3f5;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16,61,38,.06), 0 8px 24px rgba(16,61,38,.07);
  --shadow-lg: 0 20px 50px rgba(16,61,38,.18);
  --font: "Noto Sans Thai", "Prompt", system-ui, sans-serif;
  --font-h: "Prompt", "Noto Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 15.5px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--g-700); text-decoration: none; }
a:hover { color: var(--g-800); }
h1, h2, h3, h4 { font-family: var(--font-h); line-height: 1.25; margin: 0 0 .5em; color: var(--g-900); }
h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 700; }
h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0 0 1em; }
.container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Animated icons ---------- */
.ai { display: inline-flex; flex: none; vertical-align: middle; line-height: 0; }
.ai svg { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 50%; }
.ai svg * { stroke-dasharray: 1; stroke-dashoffset: 0; }
/* วาดเส้นใหม่ + ท่าทาง เมื่อ hover ที่ตัวไอคอนหรือ element แม่ที่คลิกได้ */
a:hover .ai svg *, button:hover .ai svg *, .hov:hover .ai svg *, .ai:hover svg *, .ai-intro svg * { animation: ai-draw .9s ease both; }
a:hover .ai-ring svg, button:hover .ai-ring svg, .hov:hover .ai-ring svg, .ai-ring.ai-loop svg { animation: ai-ring 1s ease; transform-origin: 50% 10%; }
a:hover .ai-spin svg, button:hover .ai-spin svg, .hov:hover .ai-spin svg { animation: ai-spin .8s ease; }
a:hover .ai-sway svg, button:hover .ai-sway svg, .hov:hover .ai-sway svg { animation: ai-sway 1s ease; transform-origin: 50% 100%; }
a:hover .ai-shake svg, button:hover .ai-shake svg, .hov:hover .ai-shake svg { animation: ai-shake .5s ease; }
a:hover .ai-bounce svg, button:hover .ai-bounce svg, .hov:hover .ai-bounce svg { animation: ai-bounce .7s ease; }
a:hover .ai-pop svg, button:hover .ai-pop svg, .hov:hover .ai-pop svg { animation: ai-pop .45s ease; }
a:hover .ai-nudge svg, button:hover .ai-nudge svg, .hov:hover .ai-nudge svg { animation: ai-nudge .6s ease; }
a:hover .ai-nudge-l svg, button:hover .ai-nudge-l svg { animation: ai-nudge-l .6s ease; }
a:hover .ai-beat svg, button:hover .ai-beat svg, .hov:hover .ai-beat svg { animation: ai-beat .8s ease; }
a:hover .ai-pulse svg, button:hover .ai-pulse svg, .hov:hover .ai-pulse svg { animation: ai-pop .5s ease; }
.ai-float svg { animation: ai-float 3.2s ease-in-out infinite; }
.ai-loop.ai-ring svg { animation: ai-ring 1.2s ease infinite; animation-delay: 1.5s; }
.ai-loop.ai-pulse svg { animation: ai-beat 1.6s ease infinite; }
.ai-loop.ai-spin svg { animation: ai-spin 6s linear infinite; }
@keyframes ai-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ai-ring { 0%,100% { transform: rotate(0) } 15% { transform: rotate(16deg) } 30% { transform: rotate(-14deg) } 45% { transform: rotate(10deg) } 60% { transform: rotate(-6deg) } 75% { transform: rotate(3deg) } }
@keyframes ai-spin { to { transform: rotate(360deg) } }
@keyframes ai-sway { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-12deg) } 60% { transform: rotate(9deg) } }
@keyframes ai-shake { 0%,100% { transform: translateX(0) } 20%,60% { transform: translateX(-2px) rotate(-6deg) } 40%,80% { transform: translateX(2px) rotate(6deg) } }
@keyframes ai-bounce { 0%,100% { transform: translateY(0) } 30% { transform: translateY(-5px) } 55% { transform: translateY(0) } 75% { transform: translateY(-2px) } }
@keyframes ai-pop { 0%,100% { transform: scale(1) } 45% { transform: scale(1.25) } }
@keyframes ai-nudge { 0%,100% { transform: translateX(0) } 50% { transform: translateX(4px) } }
@keyframes ai-nudge-l { 0%,100% { transform: translateX(0) } 50% { transform: translateX(-4px) } }
@keyframes ai-beat { 0%,100% { transform: scale(1) } 20% { transform: scale(1.22) } 40% { transform: scale(.95) } 60% { transform: scale(1.12) } }
@keyframes ai-float { 0%,100% { transform: translateY(0) rotate(0) } 50% { transform: translateY(-6px) rotate(-3deg) } }
@media (prefers-reduced-motion: reduce) { .ai svg, .ai svg * { animation: none !important; } }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font: 600 15px/1 var(--font-h); padding: 13px 22px; border-radius: 999px; background: var(--g-700); color: #fff; transition: .2s; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--g-800); color: #fff; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(31,122,77,.25); }
.btn:active { transform: translateY(0); }
.btn-light { background: var(--g-100); color: var(--g-800); }
.btn-light:hover { background: #d3eddc; color: var(--g-900); box-shadow: none; }
.btn-white { background: #fff; color: var(--g-800); border: 1px solid var(--line); }
.btn-white:hover { background: var(--g-50); color: var(--g-900); box-shadow: none; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; box-shadow: 0 8px 18px rgba(220,38,38,.25); }
.btn-ghost { background: transparent; color: var(--g-700); padding: 10px 14px; }
.btn-ghost:hover { background: var(--g-50); color: var(--g-800); box-shadow: none; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; }
.btn-xs { padding: 6px 10px; font-size: 12.5px; gap: 5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--g-50); color: var(--g-800); border: 0; cursor: pointer; position: relative; transition: .2s; }
.icon-btn:hover { background: var(--g-100); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-weight: 600; font-size: 14px; color: var(--g-900); }
.field small { color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input { width: 100%; font: 15px var(--font); color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; transition: .15s; outline: none; }
.input:focus { border-color: var(--g-500); box-shadow: 0 0 0 4px rgba(52,176,111,.15); }
textarea.input { min-height: 110px; resize: vertical; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--g-700); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label > span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; background: #fff; transition: .15s; }
.seg input:checked + span { border-color: var(--g-600); background: var(--g-50); color: var(--g-800); font-weight: 600; }
.seg input:focus-visible + span { box-shadow: 0 0 0 4px rgba(52,176,111,.2); }

/* ---------- Header ---------- */
.announce { background: var(--g-900); color: #d9f2e2; text-align: center; font-size: 13.5px; padding: 8px 16px; }
.site-header { background: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 var(--line); }
.head-row { display: flex; align-items: center; gap: 20px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--g-800); flex: none; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--g-500), var(--g-700)); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 14px rgba(31,122,77,.3); }
.brand-name { font: 700 22px/1 var(--font-h); color: var(--g-800); }
.brand-tag { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.head-search { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.head-search .input { border-radius: 999px; padding-right: 54px; background: var(--g-50); border-color: transparent; }
.head-search button { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 42px; border-radius: 50%; border: 0; background: var(--g-700); color: #fff; cursor: pointer; display: grid; place-items: center; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.badge-count { position: absolute; top: -2px; right: -2px; min-width: 19px; height: 19px; border-radius: 999px; background: var(--red); color: #fff; font: 700 11px/19px var(--font-h); text-align: center; padding: 0 5px; border: 2px solid #fff; }
.main-nav { background: var(--g-700); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.main-nav a { display: flex; align-items: center; gap: 8px; color: #e6f6ec; padding: 12px 14px; font: 500 14.5px var(--font-h); white-space: nowrap; border-radius: 10px; margin: 5px 0; }
.main-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.main-nav a.active { background: #fff; color: var(--g-800); }
.nav-toggle { display: none; }
.m-only { display: none; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 10px); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); min-width: 240px; padding: 8px; display: none; z-index: 60; border: 1px solid var(--line); }
.dropdown.open .dropdown-menu { display: block; animation: drop .18s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) } }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font: 14.5px var(--font); width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--g-50); color: var(--g-800); }
.dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.notif-menu { width: 340px; max-height: 420px; overflow: auto; }
.notif-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; }
.notif-item:hover { background: var(--g-50); }
.notif-item b { display: block; font-size: 14px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--g-100); color: var(--g-800); display: grid; place-items: center; font: 700 16px var(--font-h); flex: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 80% 0%, #dff3e6 0%, transparent 60%), linear-gradient(180deg, #f7fbf8, #eef7f1); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; padding: 56px 0 70px; }
.hero h1 { color: var(--g-800); letter-spacing: -.5px; }
.hero h1 span { color: var(--g-600); }
.hero p.lead { font-size: 18px; color: #3f5247; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; font-size: 13px; color: var(--g-800); }
.hero-art { position: relative; height: 420px; }
.fridge-art { position: absolute; inset: 0 40px 0 auto; width: 300px; margin-left: auto; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); }
.float-card { position: absolute; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; animation: floaty 5s ease-in-out infinite; }
.float-card b { display: block; font-size: 14px; color: var(--g-900); }
.float-card .dot { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }

/* ---------- Sections ---------- */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #edf3ef; }
.card-pad { padding: 22px; }
.tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; margin-top: -40px; position: relative; z-index: 2; }
.tile { background: #fff; border-radius: var(--radius); padding: 18px 10px; text-align: center; box-shadow: var(--shadow); color: var(--ink); transition: .25s; border: 1px solid #edf3ef; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--g-800); }
.tile .ic { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; }
.tile b { display: block; font: 600 14.5px var(--font-h); color: var(--g-900); }
.tile small { color: var(--muted); font-size: 12px; }
.tone-green { background: var(--g-100); color: var(--g-700); }
.tone-blue { background: var(--blue-50); color: var(--blue); }
.tone-yellow { background: var(--yellow-50); color: var(--yellow); }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-orange { background: var(--orange-50); color: var(--orange); }
.tone-pink { background: var(--pink-50); color: var(--pink); }
.tone-gray { background: var(--gray-50); color: var(--gray); }

/* covers */
.cover { position: relative; aspect-ratio: 16/10; border-radius: 14px; overflow: hidden; display: grid; place-items: center; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-green { background: linear-gradient(135deg, #d9f2e2, #a7dfbd); color: var(--g-700); }
.cover-blue { background: linear-gradient(135deg, #e3edff, #b6cdfa); color: var(--blue); }
.cover-yellow { background: linear-gradient(135deg, #fff6d6, #fbe08a); color: var(--yellow); }
.cover-red { background: linear-gradient(135deg, #ffe7e7, #f9b4b4); color: var(--red); }
.cover-orange { background: linear-gradient(135deg, #fff0e3, #fdc39a); color: var(--orange); }
.cover-pink { background: linear-gradient(135deg, #ffe8f3, #f6b3d3); color: var(--pink); }
.cover-gray { background: linear-gradient(135deg, #f3f4f6, #d6d9de); color: var(--gray); }

.news-grid { display: grid; grid-template-columns: 1.3fr 1fr .8fr; gap: 18px; }
.news-main { padding: 14px; color: var(--ink); display: block; }
.news-main .cover { aspect-ratio: 16/9; }
.news-main h3 { font-size: 20px; margin-top: 14px; }
.news-list { display: grid; gap: 14px; }
.news-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px; align-items: center; color: var(--ink); }
.news-row .cover { aspect-ratio: 4/3; border-radius: 12px; }
.news-row h4 { font-size: 15px; margin: 4px 0 0; color: var(--g-900); }
.meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.promo { border-radius: var(--radius); padding: 26px; background: linear-gradient(160deg, #e9f7ee, #c9ecd6); display: flex; flex-direction: column; justify-content: space-between; min-height: 100%; position: relative; overflow: hidden; }
.promo h3 { font-size: 28px; color: var(--g-800); line-height: 1.2; }
.promo .big-ic { position: absolute; right: -10px; bottom: -10px; color: rgba(31,122,77,.18); }

.info-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.info-card { border-radius: var(--radius); padding: 16px; min-height: 190px; display: flex; flex-direction: column; justify-content: space-between; color: var(--ink); transition: .25s; position: relative; overflow: hidden; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--ink); }
.info-card h4 { font-size: 16px; margin: 0; }
.info-card .days { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.info-card .days > span { background: rgba(255,255,255,.8); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; line-height: 1.2; display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; color: var(--g-900); }
.info-card .days > span .ai { width: 14px !important; height: 14px !important; }
.info-card .ic-wrap { align-self: flex-end; }

.recipe-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.recipe-card { padding: 12px; color: var(--ink); display: flex; flex-direction: column; gap: 10px; transition: .25s; }
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--ink); }
.recipe-card h3 { font-size: 16.5px; margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--g-50); color: var(--g-800); }
.pill-red { background: var(--red-50); color: var(--red); }
.pill-amber { background: var(--amber-50); color: var(--amber); }
.pill-gray { background: var(--gray-50); color: var(--gray); }
.pill-blue { background: var(--blue-50); color: var(--blue); }

.tools { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tool { padding: 18px; color: var(--ink); display: flex; flex-direction: column; gap: 12px; transition: .25s; }
.tool:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--g-800); }
.tool .ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.tool b { font: 600 15px var(--font-h); }
.cta-box { border-radius: var(--radius); padding: 26px; background: linear-gradient(135deg, var(--g-700), var(--g-900)); color: #e3f6ea; position: relative; overflow: hidden; }
.cta-box h3 { color: #fff; font-size: 22px; }
.cta-box .bg-ic { position: absolute; right: -20px; top: -20px; color: rgba(255,255,255,.08); }

/* ---------- Page header ---------- */
.page-hero { background: linear-gradient(180deg, #eef7f1, var(--bg)); padding: 36px 0 26px; }
.page-hero h1 { font-size: clamp(26px, 4vw, 38px); display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { padding: 9px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); font: 500 14px var(--font-h); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { border-color: var(--g-500); color: var(--g-800); }
.tab.active { background: var(--g-700); color: #fff; border-color: var(--g-700); }
.tab .n { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.tab.active .n { background: rgba(255,255,255,.25); }

/* ---------- Fridge dashboard ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.stat { padding: 18px; display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.stat b { font: 700 26px/1 var(--font-h); color: var(--g-900); display: block; }
.stat div > span { font-size: 13px; color: var(--muted); display: block; }
.alert-panel { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-bottom: 26px; }
.alert-box { padding: 20px; border-left: 5px solid var(--amber); }
.alert-box.danger { border-left-color: var(--red); }
.alert-list { display: grid; gap: 8px; margin-top: 10px; }
.alert-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--gray-50); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 220px; position: relative; }
.toolbar .search .ai { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search .input { padding-left: 44px; border-radius: 999px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.item { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: relative; border-top: 4px solid var(--g-500); transition: .2s; }
.item:hover { box-shadow: var(--shadow-lg); }
.item.st-warn { border-top-color: var(--amber); }
.item.st-danger { border-top-color: var(--red); }
.item.st-expired { border-top-color: #7f1d1d; background: #fffafa; }
.item-top { display: flex; gap: 12px; align-items: flex-start; }
.item-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.item h3 { font-size: 16.5px; margin: 0; word-break: break-word; }
.item .sub { font-size: 12.5px; color: var(--muted); }
.ring { --p: 50; --c: var(--g-600); width: 58px; height: 58px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), #edf2ee 0); display: grid; place-items: center; flex: none; margin-left: auto; }
.ring::before { content: ""; grid-area: 1/1; width: 46px; height: 46px; border-radius: 50%; background: #fff; }
.ring span { grid-area: 1/1; z-index: 1; font: 700 15px/1 var(--font-h); text-align: center; color: var(--g-900); }
.ring small { display: block; font: 500 10px var(--font); color: var(--muted); }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 12px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .ai { color: var(--g-600); margin-bottom: 10px; }
.fab { position: fixed; right: calc(18px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); width: 62px; height: 62px; border-radius: 50%; background: var(--g-700); color: #fff; border: 0; display: grid; place-items: center; box-shadow: 0 12px 26px rgba(31,122,77,.4); cursor: pointer; z-index: 40; transition: .2s; }
.fab:hover { background: var(--g-800); transform: scale(1.06); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(9,30,19,.5); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal.open { display: flex; animation: fade .2s; }
@keyframes fade { from { opacity: 0 } }
.modal-box { background: #fff; border-radius: 22px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); animation: up .25s ease; }
@keyframes up { from { transform: translateY(20px); opacity: 0 } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: #fbfdfc; position: sticky; bottom: 0; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--g-50); padding: 6px; border-radius: 14px; margin-bottom: 18px; }
.mode-tabs button { border: 0; background: transparent; padding: 10px; border-radius: 10px; font: 600 14px var(--font-h); color: var(--muted); cursor: pointer; display: flex; gap: 8px; justify-content: center; align-items: center; }
.mode-tabs button.active { background: #fff; color: var(--g-800); box-shadow: var(--shadow); }
.predict-box { border-radius: 14px; background: var(--g-50); border: 1px dashed #b9e0c7; padding: 14px 16px; margin-bottom: 14px; }
.predict-box h4 { margin: 0 0 6px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.predict-box ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; color: #3f5247; }
.scanner { border-radius: 16px; overflow: hidden; background: #0b1a12; min-height: 260px; position: relative; }
.scanner #reader { width: 100%; }
.scanner #reader video { border-radius: 0; }
.scan-hint { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 10px; }
.scan-line { position: absolute; left: 10%; right: 10%; height: 2px; background: #4ade80; box-shadow: 0 0 12px #4ade80; top: 20%; animation: scanline 2s ease-in-out infinite; z-index: 3; pointer-events: none; }
@keyframes scanline { 50% { top: 78% } }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 18px; bottom: 18px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100% - 36px)); }
.toast { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; border-left: 5px solid var(--g-600); animation: slidein .3s ease; font-size: 14.5px; }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--blue); }
.toast .x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0 } }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 40px 16px; }
.auth { display: grid; grid-template-columns: 1fr 1fr; width: min(980px, 100%); overflow: hidden; }
.auth-side { background: linear-gradient(160deg, var(--g-700), var(--g-900)); color: #e3f6ea; padding: 40px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { color: #fff; font-size: 28px; }
.auth-side ul { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 14px; }
.auth-side li { display: flex; gap: 12px; align-items: center; }
.auth-side li .ai { background: rgba(255,255,255,.12); border-radius: 12px; padding: 8px; box-sizing: content-box; }
.auth-form { padding: 40px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Article / content ---------- */
.prose { font-size: 16.5px; line-height: 1.85; }
.prose h2, .prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose img { border-radius: 14px; margin: 1em 0; }
.layout-side { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
.sticky { position: sticky; top: 140px; }
.steps { counter-reset: s; display: grid; gap: 12px; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--g-700); color: #fff; display: grid; place-items: center; font: 700 14px var(--font-h); }
.ing { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ing li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--g-50); border-radius: 12px; }
.ing li.have { background: var(--g-100); }
.guide-step { display: grid; grid-template-columns: 72px 1fr; gap: 18px; padding: 22px; align-items: start; }
.guide-step .num { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font: 600 16px var(--font-h); color: var(--g-900); list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq details[open] summary .ai { transform: rotate(180deg); }
.faq details p { margin: 10px 0 0; color: #3f5247; }
.shelf-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.shelf-table th, .shelf-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.shelf-table th { background: var(--g-50); font: 600 14px var(--font-h); color: var(--g-900); }
.shelf-table tr:hover td { background: #fbfdfc; }
.result-card { padding: 22px; border: 2px solid var(--g-100); }
.result-date { font: 700 32px/1.1 var(--font-h); color: var(--g-800); }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pager a { min-width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); color: var(--ink); }
.pager a.active { background: var(--g-700); color: #fff; border-color: var(--g-700); }
.notice { padding: 14px 16px; border-radius: 14px; background: var(--blue-50); color: #1e3a8a; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-bottom: 16px; }
.notice.warn { background: var(--amber-50); color: #7c4a03; }
.notice.ok { background: var(--g-50); color: var(--g-800); }
.notice.err { background: var(--red-50); color: #7f1d1d; }

/* ---------- Footer ---------- */
.site-footer { background: var(--g-900); color: #b9dcc6; margin-top: 60px; padding: 46px 0 22px; font-size: 14px; }
.site-footer h4 { color: #fff; font-size: 15.5px; }
.site-footer a { color: #d6efe0; }
.site-footer a:hover { color: #fff; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 26px; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 30px; padding-top: 18px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .news-grid { grid-template-columns: 1fr 1fr; }
  .news-grid .promo { grid-column: 1 / -1; min-height: 180px; }
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
  .tools { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .head-search { display: none; }
  .head-row { gap: 10px; }
  .brand-tag { display: none; }
  .nav-toggle { display: inline-grid; }
  .m-only { display: block; }
  .main-nav { display: none; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 8px 0; }
  .hero-grid { grid-template-columns: 1fr; padding: 34px 0 60px; }
  .hero-art { height: 320px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .alert-panel, .layout-side, .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .recipe-grid { grid-template-columns: repeat(2, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .head-actions .btn-ghost { display: none; }
  .brand-name { font-size: 19px; }
  .brand-mark { width: 40px; height: 40px; }
  .hero-art { height: 300px; transform: scale(.82); transform-origin: top center; }
  .tiles { grid-template-columns: repeat(2, 1fr); margin-top: -30px; }
  .info-grid, .news-grid, .recipe-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth-form { padding: 26px 20px; }
  .notif-menu { width: calc(100vw - 32px); right: -60px; }
  .guide-step { grid-template-columns: 1fr; }
  .section { padding: 34px 0; }
  .shelf-table { font-size: 13px; }
  .shelf-table th, .shelf-table td { padding: 10px 8px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: 22px 22px 0 0; max-height: 92vh; }
}

/* =========================================================
   Admin Panel
   ========================================================= */
.admin-body { background: #f3f7f4; }
.admin { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-side { background: var(--g-900); color: #cfe8d8; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.admin-side .brand-name { color: #fff; }
.admin-side nav { display: grid; gap: 2px; margin-top: 24px; }
.admin-side .grp { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: #7fb394; margin: 16px 10px 6px; }
.admin-side a { display: flex; gap: 12px; align-items: center; color: #d6eedf; padding: 10px 12px; border-radius: 12px; font: 500 14.5px var(--font-h); }
.admin-side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-side a.active { background: var(--g-600); color: #fff; }
.admin-main { padding: 26px clamp(16px, 3vw, 36px) 60px; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-top h1 { font-size: 26px; margin: 0; display: flex; gap: 12px; align-items: center; }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f7faf8; font: 600 13px var(--font-h); color: var(--muted); white-space: nowrap; position: sticky; top: 0; }
.table tr:hover td { background: #fbfdfc; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table form { display: inline; margin: 0; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 170px 1fr 40px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar .track { height: 12px; border-radius: 999px; background: var(--g-50); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--g-500), var(--g-700)); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.admin-burger { display: none; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 90; transform: translateX(-100%); transition: .25s; }
  .admin-side.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-burger { display: inline-grid; }
  .bar { grid-template-columns: 110px 1fr 34px; }
}

/* =========================================================
   Responsive fine-tuning: ทุกขนาดหน้าจอ
   ========================================================= */
@media (min-width: 1600px) {
  .container { width: min(1360px, 100% - 64px); }
  body { font-size: 16px; }
}
/* แท็บเล็ตแนวนอน / โน้ตบุ๊กจอเล็ก */
@media (max-width: 1280px) and (min-width: 861px) {
  .head-search { max-width: 340px; }
  .main-nav a { padding: 11px 10px; font-size: 14px; }
}
/* แท็บเล็ตแนวตั้ง (iPad, Galaxy Tab) */
@media (max-width: 1024px) and (min-width: 561px) {
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .items { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
/* มือถือทุกรุ่น */
@media (max-width: 560px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .info-card { min-height: 150px; padding: 14px; }
  .info-card h4 { font-size: 14.5px; }
  .info-card .days > span { font-size: 11.5px; padding: 3px 8px; }
  .info-card .ic-wrap .ai { width: 40px !important; height: 40px !important; }
  .section-head { flex-wrap: wrap; align-items: center; }
  .section-head h2 { font-size: 20px; }
  .section-head h2 .ai { width: 22px !important; height: 22px !important; }
  .stats { gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat .ic { width: 42px; height: 42px; border-radius: 13px; }
  .stat b { font-size: 22px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-inline: -16px; padding-inline: 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
  .item-actions .btn-xs { padding: 7px 9px; }
  .page-hero h1 .ai { width: 30px !important; height: 30px !important; }
  .fab { width: 56px; height: 56px; }
  .toasts { left: 12px; right: 12px; width: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }
}
/* มือถือจอเล็กมาก (iPhone SE, Galaxy Fold ด้านนอก) */
@media (max-width: 360px) {
  .container { width: calc(100% - 24px); }
  .info-grid, .tiles, .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .info-card { min-height: 135px; padding: 12px; }
  .brand-name { font-size: 17px; }
  .head-actions .btn-sm { padding: 8px 12px; font-size: 13px; }
  .tool-grid, .recipe-grid { grid-template-columns: 1fr; }
}
/* อุปกรณ์จอสัมผัส: ไม่มี hover ให้ไอคอนเล่นแอนิเมชันตอนแตะ และขยายพื้นที่กด */
@media (hover: none) {
  a:active .ai svg *, button:active .ai svg * { animation: ai-draw .7s ease both; }
  .tile:hover, .info-card:hover, .recipe-card:hover, .tool:hover { transform: none; }
  .btn-xs { min-height: 34px; }
}
/* มือถือแนวนอน */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header { position: static; }
  .modal-box { max-height: 96vh; }
}

/* ---------- กล่องตั้งค่าการแจ้งเตือนในฟอร์มรายการ ---------- */
.notify-box { border: 1.5px solid #cfe9d8; background: #f7fcf9; border-radius: 16px; padding: 14px 16px 6px; margin: 4px 0 14px; min-width: 0; }
.notify-box legend { font: 600 15px var(--font-h); color: var(--g-800); padding: 0 6px; display: flex; gap: 8px; align-items: center; }
.notify-box .switch { margin-bottom: 12px; font-weight: 600; }
.notify-box.off .notify-fields { opacity: .45; pointer-events: none; }
.seg-days { gap: 6px; }
.seg-days label > span { padding: 7px 12px; font-size: 13.5px; }
.notify-preview { font-size: 13.5px; background: #fff; border: 1px dashed #b9e0c7; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; color: #3f5247; }
.notify-preview b { color: var(--g-800); }
.item-notify { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--muted); background: var(--g-50); border-radius: 10px; padding: 8px 10px; }
.item-notify b { color: var(--g-800); font-weight: 600; }
.item-notify.off { background: var(--gray-50); }
