:root { --accent: #22d3ee; --accent-2: #34d399; }
* { font-family: 'Noto Sans Thai', 'Space Grotesk', sans-serif; }
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; }
.font-display, h1, h2, .brand, .stamp { font-family: 'Space Grotesk', 'Noto Sans Thai', sans-serif; }
body { background-color: #f4f7fb; background-image: radial-gradient(circle at 15% 20%, rgba(34,211,238,.12), transparent 40%), radial-gradient(circle at 85% 0%, rgba(52,211,153,.10), transparent 40%); color: #1e293b; }
h1 { line-height: 1.1; letter-spacing: -0.03em; }
p { line-height: 1.7; }
.tech-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(15,23,42,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.06) 1px, transparent 1px); background-size: 42px 42px; -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 85%); mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 85%); animation: gridDrift 22s linear infinite; pointer-events: none; }
@keyframes gridDrift { to { background-position: 42px 42px, 42px 42px; } }
.glow-blob { position: absolute; border-radius: 9999px; filter: blur(70px); opacity: .35; pointer-events: none; width: 280px; height: 280px; }
.glow-blob.a { background: var(--accent); top: -90px; left: -60px; }
.glow-blob.b { background: var(--accent-2); top: -60px; right: -40px; }
.pulse-dot { animation: pulseDot 2s ease-in-out infinite; }
@keyframes pulseDot { 50% { opacity: .35; } }
.topnav a.back { border: 1px solid rgba(15,23,42,.12); background: rgba(255,255,255,.8); color: #475569; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.topnav a.back:hover { border-color: rgba(6,182,212,.5); color: #0e7490; background: #fff; }
.card-x { background: rgba(255,255,255,.88); border: 1px solid rgba(15,23,42,.08); border-radius: 1rem; box-shadow: 0 4px 16px -4px rgba(15,23,42,.10); backdrop-filter: blur(6px); }
.rise { animation: rise 300ms ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.btn { transition: background-color 150ms ease, transform 150ms ease; }
.btn:hover { transform: translateY(-1px); }
tbody tr { transition: background-color 150ms ease; }
.opt { cursor: pointer; border: 1px solid rgba(15,23,42,.14); border-radius: .75rem; transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease; }
.opt:hover { border-color: #06b6d4; }
.opt:has(input:checked) { border-color: #06b6d4; background: rgba(34,211,238,.10); box-shadow: 0 4px 16px -6px rgba(6,182,212,.4); }
.opt:has(input:disabled) { opacity: .55; cursor: default; }
.dcard { cursor: pointer; transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease; }
.dcard:hover { transform: translateY(-4px); border-color: rgba(6,182,212,.4); box-shadow: 0 16px 36px -16px rgba(6,182,212,.35); }
.meter { height: 10px; border-radius: 99px; background: oklch(92% 0.01 200); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; transition: width 600ms ease-out, background-color 300ms ease; }
.meter.low > i { background: #fbbf24; }   /* ใช้น้อย — เหลือง */
.meter.ok > i { background: #22c55e; }    /* พอดี — เขียว */
.meter.over > i { background: #ef4444; }  /* เกินยอด — แดง */
.stamp { font-family: 'Prompt', sans-serif; font-weight: 700; letter-spacing: .08em; }
/* toast */
#toast-box { position: fixed; inset: auto; top: 1rem; right: 1rem; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; display: flex; flex-direction: column; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); }
#toast-box:not(:popover-open) { display: none; }
.tst { user-select: text; animation: tin 250ms ease-out both; transition: opacity 250ms ease, transform 250ms ease; }
.tst.settled { animation: none; }
.tst.out { opacity: 0; transform: translateX(1rem); }
@keyframes tin { from { opacity: 0; transform: translateX(1rem); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* การ์ดหลักที่มีแท็บเป็นส่วนหนึ่ง — การ์ดย่อยด้านในไม่ต้องลอยซ้อน */
.shell .card-x { box-shadow: none; backdrop-filter: none; background: #fff; border-color: rgba(15,23,42,.10); }
.shell .dcard:hover { box-shadow: 0 10px 24px -14px rgba(6,182,212,.4); }
.shell .tab { color: #475569; transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease; }
.shell .tab:hover { color: #0e7490; background: rgba(34,211,238,.08); }
.shell .tab.tab-active { color: #0e7490; font-weight: 600; border-bottom-color: #06b6d4; }

/* ปุ่มสีสด — ไล่เฉดฟ้า→เขียวเหมือนแสงพื้นหลังของเว็บแม่ */
[data-theme=nord] { --p: 76% 0.15 205; --pc: 22% 0.05 225; --a: 75% 0.17 160; --ac: 22% 0.05 165; }
.btn-primary { border: 0; background-image: linear-gradient(135deg, #22d3ee, #34d399); color: #083344; box-shadow: 0 6px 16px -6px rgba(6,182,212,.7); font-weight: 600; }
.btn-primary:hover { background-image: linear-gradient(135deg, #06b6d4, #10b981); box-shadow: 0 10px 22px -8px rgba(6,182,212,.8); }
.btn-accent { border: 0; background-color: #fbbf24; color: #422006; box-shadow: 0 6px 16px -6px rgba(245,158,11,.7); font-weight: 600; }
.btn-accent:hover { background-color: #f59e0b; }
.btn-outline { border-color: #06b6d4; color: #0e7490; background: #fff; }
.btn-outline:hover { background-color: #06b6d4; border-color: #06b6d4; color: #083344; }
.badge-accent { background-color: #a7f3d0; border-color: #a7f3d0; color: #064e3b; font-weight: 600; }

/* แท็บวิชาแบบ sheet ของ Excel (อยู่ล่างการ์ด) */
.sheet-tabs { display: flex; align-items: flex-end; gap: 2px; overflow-x: auto; padding: 6px 10px 0; background: #e8eef4; border-top: 1px solid rgba(15,23,42,.14); scrollbar-width: thin; }
.sheet-tab { display: inline-flex; align-items: center; gap: .4rem; max-width: 15rem; padding: .45rem .9rem; font-size: .875rem; white-space: nowrap; color: #475569; background: #d7e1ea; border: 1px solid rgba(15,23,42,.12); border-top: 0; border-radius: 0 0 .6rem .6rem; transition: background-color 150ms ease, color 150ms ease; }
.sheet-tab:hover { background: #f1f6fa; color: #0e7490; }
.sheet-tab.on { background: #fff; color: #0e7490; font-weight: 600; box-shadow: 0 -2px 0 #06b6d4 inset; margin-top: -1px; }
.sheet-tab.add { background: transparent; border-color: transparent; color: #0e7490; }
.lvdot { font-size: .7rem; font-weight: 700; padding: 0 .4rem; border-radius: 99px; flex-shrink: 0; }
.lvdot.vc { background: #a7f3d0; color: #064e3b; }
.lvdot.vs { background: #fde68a; color: #422006; }

/* รายการที่บวก +20% ต่อชิ้น — ข้อความสีส้มเข้ม */
.mk-text { color: #c2410c; font-weight: 600; }
