/* ============================================================
   AIKUB Design System v3 — "COO Analytics"
   Minimal light theme · white cards · ink buttons · violet data accent
   อ้างรูปแบบ: COO Dashboard — Modern Business Performance Analytics UI
   ============================================================ */

/* ---------- Design Tokens : LIGHT ---------- */
:root {
    --bg: #F2F3F5;
    --surface: #FFFFFF;
    --surface-2: #F5F6F8;
    --surface-hover: #F3F4F6;
    --border: #EBECEF;
    --border-strong: #DCDEE4;
    --text: #17181C;
    --muted: #7A7F8C;
    --muted-2: #A3A8B3;

    /* ปุ่มหลักสีหมึก (near-black) เหมือน "Start my Day" ในดีไซน์ต้นแบบ */
    --ink: #17181C;
    --ink-hover: #2A2B33;
    --ink-contrast: #FFFFFF;
    --ink-soft: #F1F2F4;

    /* สีเน้นข้อมูล/ลิงก์ = ม่วง violet แบบเส้นกราฟในดีไซน์ */
    --primary: #8B5CF6;
    --primary-hover: #7C3AED;
    --primary-soft: rgba(139, 92, 246, .10);
    --primary-ring: rgba(139, 92, 246, .25);
    --grad-a: #8B5CF6;
    --grad-b: #6366F1;
    --grad-c: #22D3EE;

    --success: #16A34A;
    --success-soft: rgba(22, 163, 74, .10);
    --danger: #DC2626;
    --danger-soft: rgba(220, 38, 38, .09);
    --warn: #D97706;
    --warn-soft: rgba(217, 119, 6, .11);

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-xs: 0 1px 2px rgba(23, 24, 28, .05);
    --shadow-sm: 0 1px 2px rgba(23, 24, 28, .04), 0 4px 14px -4px rgba(23, 24, 28, .07);
    --shadow: 0 1px 2px rgba(23, 24, 28, .04), 0 12px 32px -8px rgba(23, 24, 28, .10);
    --shadow-lg: 0 4px 10px rgba(23, 24, 28, .05), 0 28px 64px -16px rgba(23, 24, 28, .18);
    --glow: 0 8px 24px -8px var(--primary-ring);

    --font: 'Itim', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

    --sidebar-w: 264px;
    --nav-h: 66px;

    --ease-spring: cubic-bezier(.22, .68, .35, 1.05);
    --ease-out: cubic-bezier(.22, .61, .36, 1);
    --ease-out-soft: cubic-bezier(.16, 1, .3, 1);
    --ease-in-out-soft: cubic-bezier(.65, 0, .35, 1);
    color-scheme: light;
}

/* ---------- Design Tokens : DARK ---------- */
[data-theme="dark"] {
    --bg: #0E0F12;
    --surface: #16171B;
    --surface-2: #1D1E24;
    --surface-hover: #202128;
    --border: #26272E;
    --border-strong: #34353E;
    --text: #F0F1F4;
    --muted: #9BA0AC;
    --muted-2: #6A6F7A;

    --ink: #F4F5F7;
    --ink-hover: #FFFFFF;
    --ink-contrast: #121317;
    --ink-soft: #22232A;

    --primary: #A78BFA;
    --primary-hover: #BFA8FD;
    --primary-soft: rgba(167, 139, 250, .13);
    --primary-ring: rgba(167, 139, 250, .28);

    --success: #34D399;
    --success-soft: rgba(52, 211, 153, .13);
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, .12);
    --warn: #FBBF24;
    --warn-soft: rgba(251, 191, 36, .13);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -8px rgba(0, 0, 0, .55);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 56px -12px rgba(0, 0, 0, .65);

    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background .25s ease, color .25s ease;
}
a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-hover); }
code { font-family: var(--font-mono); font-size: .9em; }
img { max-width: 100%; }

::selection { background: var(--primary); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong); border-radius: 8px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(28px) scale(.97); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(.96); } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.45); } 60% { box-shadow: 0 0 0 7px rgba(16,185,129,0); } }
@keyframes gradientFlow { to { background-position: 200% center; } }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-14px) } }
@keyframes shineSweep { from { left: -70%; } to { left: 130%; } }
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(36px, -28px) scale(1.08); }
    66% { transform: translate(-26px, 22px) scale(.94); }
}

.fade-up { animation: fadeUp .5s var(--ease-out-soft) both; }
.toast-out { animation: toastOut .28s var(--ease-out) both; pointer-events: none; }

/* สลับธีม Light/Dark — JS ติด class นี้ไว้ ~400ms ให้ทุกสีเฟดลื่นแทนการสลับตึดตั๋ว */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color .35s var(--ease-in-out-soft), background .35s var(--ease-in-out-soft),
                border-color .35s var(--ease-in-out-soft), color .35s var(--ease-in-out-soft),
                box-shadow .35s var(--ease-in-out-soft), fill .35s var(--ease-in-out-soft) !important;
}

/* เปลี่ยนหน้าแบบ cross-fade (Chrome/Edge 126+ — เบราว์เซอร์อื่นข้ามไปใช้การโหลดปกติ) */
@view-transition { navigation: auto; }

/* เคารพการตั้งค่าลดการเคลื่อนไหวของระบบ (accessibility) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* ============================================================
   BUTTONS — ทรง pill ทั้งหมดตามดีไซน์ต้นแบบ
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font); font-weight: 600; font-size: 14px; letter-spacing: .1px;
    padding: 10px 22px; border-radius: 999px;
    border: 1px solid transparent; cursor: pointer;
    position: relative; overflow: hidden; isolation: isolate;
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out), background .22s var(--ease-out),
                color .22s var(--ease-out), border-color .22s var(--ease-out);
    text-decoration: none; line-height: 1.4; white-space: nowrap;
}
.btn:active { transform: translateY(0) scale(.975); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: var(--ink);
    color: var(--ink-contrast);
    box-shadow: var(--shadow-sm);
}
.btn-primary::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,.16), transparent);
    left: -70%; transform: skewX(-18deg);
}
.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--ink-hover);
    box-shadow: var(--shadow);
    color: var(--ink-contrast);
}
.btn-primary:hover::after { animation: shineSweep .7s ease forwards; }

.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted-2); color: var(--text); transform: translateY(-1px); }

.btn-outline { background: var(--surface); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); box-shadow: var(--shadow-xs); }
.btn-outline:hover { background: var(--primary-soft); border-color: var(--primary); transform: translateY(-2px); color: var(--primary); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { transform: translateY(-2px); color: #fff; box-shadow: var(--shadow); filter: brightness(1.06); }

/* ปุ่มลบแบบ ghost สีแดง — เบากว่า btn-danger เหมาะกับแถวในตาราง */
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); box-shadow: var(--shadow-xs); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; box-shadow: var(--shadow-sm); }
.btn-success:hover { transform: translateY(-2px); color: #fff; filter: brightness(1.06); }

.btn-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.btn-warn:hover { background: color-mix(in srgb, var(--warn) 20%, transparent); color: inherit; }

.btn-google { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-google:hover { background: var(--surface-hover); transform: translateY(-2px); box-shadow: var(--shadow-sm); color: var(--text); }

.btn-sm { padding: 6px 15px; font-size: 13px; }
.btn-lg { padding: 14px 30px; font-size: 15.5px; }
.w-full { width: 100%; }

.ripple-ink {
    position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
    background: rgba(255,255,255,.35); transform: scale(0);
    animation: ripple .55s ease-out forwards;
}
.btn-ghost .ripple-ink, .btn-outline .ripple-ink, .btn-google .ripple-ink, .btn-warn .ripple-ink {
    background: rgba(139,92,246,.14);
}

/* ============================================================
   ICONS — inline SVG (Lucide) ขนาดตาม font-size ของจุดที่วาง
   ============================================================ */
svg.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.18em; }
.side-nav a .icon, .btn .icon, .channel-tab .icon, .theme-toggle .icon { width: 17px; height: 17px; }
.theme-toggle span { display: inline-flex; }
.feature-icon .icon { width: 28px; height: 28px; color: var(--primary); }
.empty-icon .icon { width: 36px; height: 36px; color: var(--muted); }
.card-head h3 .icon, .doc-card h2 .icon, .quick-link .icon { color: var(--primary); }
.key-created h3 .icon { color: var(--success); }
.form-group > label .icon { width: 15px; height: 15px; color: var(--muted); vertical-align: -.15em; }
.check-row .icon, .announce-bar .icon { width: 15px; height: 15px; vertical-align: -.2em; }
.callout .icon, .text-danger .icon { width: 14px; height: 14px; vertical-align: -.15em; }
.brand-mark .icon { width: 22px; height: 22px; }
.modal-x { display: inline-flex; align-items: center; }
.modal-x .icon, .toast-x .icon { width: 14px; height: 14px; display: block; }
.toast-icon { display: flex; flex: none; margin-top: 2px; }
.toast-icon .icon { width: 18px; height: 18px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warn); }
.toast-info .toast-icon { color: var(--primary); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; transition: transform .22s var(--ease-spring), box-shadow .22s var(--ease-out), border-color .22s var(--ease-out), background .22s var(--ease-out); box-shadow: var(--shadow-xs);
}
.theme-toggle:hover { transform: translateY(-1px) rotate(-8deg); box-shadow: var(--shadow-sm); border-color: var(--primary); }
.theme-toggle .tt-moon { display: none; }
[data-theme="dark"] .theme-toggle .tt-sun { display: none; }
[data-theme="dark"] .theme-toggle .tt-moon { display: inline; }

/* ---------- Hamburger (แสดงเฉพาะจอเล็ก) ---------- */
.menu-btn {
    display: none; width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface);
    cursor: pointer; box-shadow: var(--shadow-xs);
    flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    flex-shrink: 0; transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out);
}
.menu-btn span {
    display: block; width: 16px; height: 2px; border-radius: 2px;
    background: var(--text); transition: transform .2s ease, opacity .2s ease;
}
.menu-btn:hover { border-color: var(--muted-2); box-shadow: var(--shadow-sm); }
body.sidebar-open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.sidebar-open .menu-btn span:nth-child(2) { opacity: 0; }
body.sidebar-open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   RATE BADGE — ตัวคูณราคาของโมเดล (0x–30x แบ่ง 4 ระดับ)
   เขียว = ต่ำ · เหลือง = ปานกลาง · ส้ม = สูง · แดง = สูงสุด
   ============================================================ */
.rate-badge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 600; line-height: 1.5;
    padding: 1px 8px; border-radius: 999px; white-space: nowrap;
    border: 1.5px solid transparent; vertical-align: middle;
    font-family: var(--font-mono); letter-spacing: .2px;
}
.rate-low  { color: #15803D; background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.45); }
.rate-mid  { color: #A16207; background: rgba(234,179,8,.15);  border-color: rgba(234,179,8,.5); }
.rate-high { color: #C2410C; background: rgba(249,115,22,.13); border-color: rgba(249,115,22,.5); }
.rate-max  { color: #B91C1C; background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.5); }
[data-theme="dark"] .rate-low  { color: #4ADE80; background: rgba(34,197,94,.16); }
[data-theme="dark"] .rate-mid  { color: #FACC15; background: rgba(234,179,8,.16); }
[data-theme="dark"] .rate-high { color: #FB923C; background: rgba(249,115,22,.16); }
[data-theme="dark"] .rate-max  { color: #F87171; background: rgba(239,68,68,.16); }
.rate-legend {
    display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--muted);
}
.model-cell .rate-badge { margin-left: 7px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; padding: 3px 11px;
    border-radius: 999px; white-space: nowrap; line-height: 1.5;
}
.badge-soft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-success::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse-dot 2s infinite; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* ============================================================
   PUBLIC NAVBAR (frosted white)
   ============================================================ */
.public-body { min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.nav {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 11px;
    background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
    color: #fff; font-weight: 700; font-size: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px -4px var(--primary-ring);
    transition: transform .3s var(--ease-spring), box-shadow .3s var(--ease-out);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); box-shadow: 0 8px 22px -6px var(--primary-ring); }
.brand-name { font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: .2px; }
.brand-name small { font-size: 11px; color: var(--muted); font-weight: 600; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--muted); font-weight: 500; position: relative; padding: 4px 0; }
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
    content: ''; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--grad-a), var(--grad-c));
    transition: width .25s var(--ease-spring);
}
.nav-links a:hover::after { width: 100%; }
.nav-actions { display: flex; gap: 10px; align-items: center; }
.main-content { flex: 1; width: 100%; position: relative; z-index: 1; }

/* ---------- เมนูมือถือ (public) ---------- */
.mobile-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 49;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg); padding: 10px 20px 18px;
}
/* สไตล์เฉพาะลิงก์เมนูโดยตรง — ไม่แตะปุ่ม .btn ใน .mm-actions (ไม่งั้นสีตัวอักษรทับกัน) */
.mobile-menu > a {
    display: block; padding: 12px 10px; color: var(--text); font-weight: 600;
    border-bottom: 1px solid var(--border); font-size: 15px;
}
.mobile-menu > a:last-of-type { border-bottom: none; }
.mobile-menu .mm-actions { display: flex; gap: 10px; padding-top: 14px; }
.mobile-menu .mm-actions .btn { flex: 1; }
body.menu-open .mobile-menu { display: block; animation: fadeUp .25s var(--ease-spring) both; }

/* ============================================================
   HERO — พื้นสว่าง เน้นตัวอักษรดำใหญ่ orb จาง ๆ
   ============================================================ */
.hero { position: relative; text-align: center; padding: 104px 24px 72px; overflow: hidden; }
.hero-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.orb {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35;
    animation: orbFloat 16s var(--ease-in-out-soft) infinite;
    will-change: transform;
}
.orb-1 { width: 420px; height: 420px; top: -140px; left: -80px; background: radial-gradient(circle, var(--grad-a), transparent 65%); }
.orb-2 { width: 380px; height: 380px; top: -60px; right: -60px; background: radial-gradient(circle, var(--grad-c), transparent 65%); animation-delay: -5s; }
.orb-3 { width: 300px; height: 300px; top: 180px; left: 42%; background: radial-gradient(circle, var(--grad-b), transparent 65%); animation-delay: -9s; opacity: .25; }
.grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 75% 62% at 50% 32%, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 75% 62% at 50% 32%, black 30%, transparent 75%);
    opacity: .5;
}
.hero > *:not(.hero-decor) { position: relative; z-index: 1; }

.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface); color: var(--text);
    font-size: 13px; font-weight: 600; padding: 7px 18px; border-radius: 999px;
    border: 1px solid var(--border); box-shadow: var(--shadow-xs);
    margin-bottom: 26px;
}
.hero-badge::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: var(--success); animation: pulse-dot 2s infinite;
}
.hero-title { font-size: clamp(38px, 6.4vw, 62px); font-weight: 700; line-height: 1.12; letter-spacing: -1.4px; color: var(--text); }
.gradient-text {
    background: linear-gradient(90deg, var(--grad-a), var(--grad-b), var(--grad-c), var(--grad-a));
    background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 7s linear infinite;
}
.hero-sub { max-width: 640px; margin: 22px auto 34px; color: var(--muted); font-size: 17.5px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
    display: flex; gap: 20px; justify-content: center; margin-top: 60px; flex-wrap: wrap;
}
.hero-stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px 34px; box-shadow: var(--shadow-xs);
    transition: transform .3s var(--ease-out-soft), box-shadow .3s var(--ease-out);
}
.hero-stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.hero-stat strong {
    display: block; font-size: 27px; letter-spacing: -.5px;
    background: linear-gradient(120deg, var(--grad-a), var(--grad-b));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-stat span { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 44px 0; position: relative; }
.section-title { text-align: center; font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; letter-spacing: -.8px; }
.section-sub { text-align: center; color: var(--muted); margin: 10px auto 36px; max-width: 560px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; }
.feature-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-xs);
    transition: transform .3s var(--ease-out-soft), box-shadow .3s var(--ease-out), border-color .3s var(--ease-out);
    position: relative; overflow: hidden;
}
.feature-card::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--grad-a), var(--grad-b), var(--grad-c));
    opacity: 0; transition: opacity .25s ease;
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.feature-card:hover::before { opacity: 1; }
.feature-icon {
    width: 52px; height: 52px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    background: var(--surface-2); margin-bottom: 16px;
    box-shadow: inset 0 0 0 1px var(--border);
}
.feature-card h3 { font-size: 17px; margin-bottom: 7px; letter-spacing: -.2px; }
.feature-card p { font-size: 14px; color: var(--muted); }

.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.pool-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 30px 26px; text-align: center; box-shadow: var(--shadow-xs);
    transition: transform .3s var(--ease-out-soft), box-shadow .3s var(--ease-out), border-color .3s var(--ease-out);
}
.pool-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}
.pool-icon {
    width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center; font-size: 28px;
    background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
}
.pool-card h3 { font-size: 17.5px; letter-spacing: -.2px; }
.pool-card p { font-size: 13px; margin: 7px 0 14px; color: var(--muted); }
.pool-meta {
    font-size: 12.5px; font-weight: 600; color: var(--primary);
    background: var(--primary-soft); display: inline-block; padding: 4px 14px; border-radius: 999px;
}

.cta-box {
    text-align: center; padding: 60px 28px; margin: 52px 0 56px;
    border-radius: var(--radius-xl); position: relative; overflow: hidden;
    background:
        radial-gradient(600px 200px at 15% 0%, rgba(139,92,246,.35), transparent 60%),
        radial-gradient(500px 220px at 85% 100%, rgba(34,211,238,.25), transparent 60%),
        #101014;
    color: #fff;
    box-shadow: var(--shadow-lg);
}
.cta-box::before {
    content: ''; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse at center, black, transparent 78%);
}
.cta-box > * { position: relative; }
.cta-box h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 10px; letter-spacing: -.6px; }
.cta-box p { margin-bottom: 24px; opacity: .82; }
.cta-box .muted { color: rgba(255,255,255,.72) !important; }
.cta-box .btn-primary { background: #fff; color: #101014; box-shadow: 0 10px 34px -8px rgba(255,255,255,.35); }
.cta-box .btn-primary:hover { background: #F1F1F4; color: #101014; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    border-top: 1px solid var(--border); padding: 30px 0; margin-top: 40px;
    background: var(--surface);
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 14px; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--primary); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    transition: box-shadow .2s ease;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.p-3 { padding: 22px; }
.pt-0 { padding-top: 0; }

/* ============================================================
   STAT CARDS — เลขใหญ่หนาแบบ KPI ในดีไซน์ต้นแบบ
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-grid-6 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat-card { padding: 24px; position: relative; overflow: hidden; }
.stat-card::after {
    content: ''; position: absolute; top: 0; right: 0; width: 110px; height: 110px;
    background: radial-gradient(circle at top right, var(--primary-soft), transparent 70%);
    pointer-events: none;
}
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 13px; color: var(--muted); font-weight: 500; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }

/* ============================================================
   TABLES — เส้นบาง ส่วนหัวจาง ๆ แบบ minimal
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .8px;
    padding: 13px 18px; border-bottom: 1px solid var(--border);
    background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .16s var(--ease-out), box-shadow .16s var(--ease-out); }
.table tbody tr:hover { background: var(--surface-hover); box-shadow: inset 3px 0 0 var(--primary); }
/* คอลัมน์ตัวเลขชิดขวา — th ต้องชิดขวาตาม td (เพราะ .table th ชนะ .ta-r ด้วย specificity) */
.table th.ta-r { text-align: right; }
.table td.ta-r, .table td.mono { white-space: nowrap; }
.row-muted { opacity: .5; }
.row-highlight { background: var(--warn-soft); }
.nowrap { white-space: nowrap; }
.model-name {
    background: var(--primary-soft); color: var(--primary);
    padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
    white-space: nowrap;
}

/* ============================================================
   FORMS
   ============================================================ */
.form { padding: 24px; }
.form-group { margin-bottom: 17px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }

/* ปิด widget native ของเบราว์เซอร์ กล่องทุกชนิดวาดเองให้สม่ำเสมอ
   input:not([type]) = ช่องที่ลืมใส่ type (default คือ text) ต้องโดนด้วย */
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=url], input[type=tel], input[type=date], select, textarea {
    -webkit-appearance: none;
    appearance: none;
    width: 100%; padding: 11px 15px; font-family: var(--font); font-size: 14.5px;
    border: 1.5px solid var(--border-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s var(--ease-out);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border-strong));
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; background: var(--surface-2); }

/* Select — ลูกศร custom (appearance:none กินลูกศรเดิมไป) */
select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23A3A8B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    cursor: pointer;
}

/* Number — เอา spinner ปุ่มลูกศรขึ้น/ลง ที่ทำให้ดูรกออก */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Search — ลบปุ่ม ✕ ของ WebKit */
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Autofill ของ Chrome — ไม่ให้กลายเป็นกล่องขาวสี่เหลี่ยม (โดยเฉพาะ Dark Mode) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 60px var(--surface) inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    transition: background-color 99999s ease-in-out 0s;
}

/* Checkbox / Radio ที่แสดงผล — ใช้สี brand มุมโค้ง */
input[type=checkbox], input[type=radio] {
    accent-color: var(--primary);
    width: 17px; height: 17px;
    border-radius: 5px; cursor: pointer;
}
input[type=radio] { border-radius: 50%; }

.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.kv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv-table td { padding: 11px 22px; border-bottom: 1px solid var(--border); }
.kv-table tr:last-child td { border-bottom: none; }
.kv-table td:first-child { color: var(--muted); width: 40%; font-weight: 500; }

/* ============================================================
   APP SHELL (sidebar layout)
   ============================================================ */
.shell-body { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 20px 22px 14px; }
.side-nav { flex: 1; padding: 10px 14px; overflow-y: auto; }
.side-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; margin: 3px 0; border-radius: 999px;
    color: var(--muted); font-weight: 500; font-size: 14.5px;
    transition: background .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out); position: relative;
}
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
/* รายการที่กำลังใช้ = ปุ่มหมึกดำ ตัวอักษรขาว (เหมือน active วงกลมดำในดีไซน์ต้นแบบ) */
.side-nav a.active { background: var(--ink); color: var(--ink-contrast); font-weight: 600; box-shadow: var(--shadow-sm); }
.side-admin { color: var(--warn) !important; }
.side-nav a.side-admin.active { background: var(--warn); color: #fff !important; }
.side-sep { height: 1px; background: var(--border); margin: 12px 6px; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 8px 6px 12px; min-width: 0; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    box-shadow: 0 3px 10px -3px var(--primary-ring);
}
.user-email { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 30px;
    background: color-mix(in srgb, var(--bg) 75%, transparent);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.docs-link { white-space: nowrap; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-content { padding: 30px; max-width: 1280px; width: 100%; }

.balance-chip {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    padding: 8px 17px; border-radius: 999px; box-shadow: var(--shadow-xs);
    transition: box-shadow .25s var(--ease-out), transform .25s var(--ease-out), border-color .25s var(--ease-out);
}
.balance-chip:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-sm), 0 6px 18px -8px var(--primary-ring);
}
.balance-label { font-size: 12px; color: var(--muted); }
.balance-value {
    font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
    background: linear-gradient(120deg, var(--grad-a), var(--grad-b));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---------- Scrim พื้นหลังตอนเปิด drawer บนมือถือ ---------- */
.scrim {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(14, 15, 18, .48);
    opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-out);
}
body.sidebar-open .scrim { opacity: 1; pointer-events: auto; }

/* ---------- Grids ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-grid, .topup-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 20px; align-items: start; }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-link {
    padding: 20px; text-align: center; font-weight: 600; color: var(--text);
    transition: transform .22s var(--ease-out-soft), box-shadow .22s var(--ease-out), color .22s var(--ease-out);
}
.quick-link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--primary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 54px 20px; }
.empty-icon {
    width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 24px;
    display: flex; align-items: center; justify-content: center; font-size: 34px;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border);
    animation: floaty 4s ease-in-out infinite;
}
.empty-state h3 { font-size: 17px; margin-bottom: 5px; }
.empty-state p { margin-bottom: 16px; color: var(--muted); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(14, 15, 18, .5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); width: 100%; max-width: 490px;
    box-shadow: var(--shadow-lg);
    animation: popIn .26s var(--ease-spring) both;
    max-height: 90vh; overflow-y: auto;
}
.modal-lg { max-width: 640px; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16.5px; letter-spacing: -.2px; }
.modal-x {
    background: var(--surface-2); border: none; font-size: 13px; color: var(--muted);
    cursor: pointer; padding: 6px 10px; border-radius: 999px; transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.modal-x:hover { background: var(--danger-soft); color: var(--danger); }
.modal form { padding: 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ============================================================
   TOASTS — notification card style (asklepios-inspired)
   การ์ดลอย: chip ไอคอนสี tint · หัวข้อหนา+คำอธิบาย · เวลา · progress bar
   ============================================================ */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 12px; width: min(384px, calc(100vw - 24px)); }
.toast {
    display: grid; grid-template-columns: auto 1fr auto; align-items: flex-start; gap: 13px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 15px 15px 18px;
    animation: toastIn .38s var(--ease-spring) both;
    position: relative; overflow: hidden;
}
.toast-icon {
    width: 42px; height: 42px; flex: none; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
    animation: toastIconPop .5s var(--ease-spring) .08s both;
}
.toast-icon svg.icon { width: 21px; height: 21px; }
.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-error   .toast-icon { background: var(--danger-soft);  color: var(--danger); }
.toast-warning .toast-icon { background: var(--warn-soft);    color: var(--warn); }
.toast-info    .toast-icon { background: var(--primary-soft); color: var(--primary); }

.toast-main { min-width: 0; padding-top: 2px; }
.toast-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; line-height: 1.3; }
.toast-msg { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.toast-time { display: block; font-size: 11px; color: var(--muted-2); margin-top: 6px; font-variant-numeric: tabular-nums; }

.toast-x {
    background: none; border: none; cursor: pointer; color: var(--muted-2);
    padding: 4px; border-radius: 8px; line-height: 0; transition: color .15s ease, background .15s ease;
}
.toast-x svg.icon { width: 15px; height: 15px; }
.toast-x:hover { color: var(--text); background: var(--surface-hover); }

.toast-bar {
    position: absolute; left: 15px; right: 15px; bottom: 6px; height: 3px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--grad-a), var(--grad-c));
    transform-origin: left;
    animation: toastCountdown linear forwards;
    opacity: .85;
}
@keyframes toastCountdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toastIconPop { from { transform: scale(.4) rotate(-14deg); } 60% { transform: scale(1.12) rotate(4deg); } to { transform: scale(1) rotate(0); } }

/* ============================================================
   ANNOUNCE POPUP — ป็อปอัพประกาศหน้า home (สไตล์ pzshop)
   backdrop ดำเบลอ · การ์ดรูป rounded · ปุ่มปิด/checkbox แบบ pill กลืนหลังมืด
   ============================================================ */
.announce-backdrop {
    position: fixed; inset: 0; z-index: 400;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; transition: opacity .3s var(--ease-out);
}
.announce-backdrop.open { opacity: 1; }
.announce-dim {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .7);
    -webkit-backdrop-filter: blur(4px) saturate(1.05);
    backdrop-filter: blur(4px) saturate(1.05);
    transition: opacity .3s var(--ease-out);
}
.announce-col {
    position: relative; display: flex; flex-direction: column; gap: 10px;
    width: fit-content; max-width: min(560px, 92vw);
    transform: translateY(18px) scale(.96); opacity: 0;
    transition: transform .32s var(--ease-spring), opacity .3s var(--ease-out);
}
.announce-backdrop.open .announce-col { transform: translateY(0) scale(1); opacity: 1; }

.announce-card {
    position: relative; display: block; overflow: hidden;
    border-radius: var(--radius-lg); background: var(--surface);
    transition: opacity .2s ease; cursor: pointer; max-width: 100%;
}
.announce-card:hover { opacity: .97; }
.announce-card img {
    display: block; width: auto; max-width: min(560px, 92vw);
    height: auto; max-height: min(70vh, 480px);
    object-fit: contain; user-select: none; pointer-events: none;
}

/* ข้อความ (กรณีไม่ใช้รูป) */
.announce-body { padding: 30px 26px; text-align: center; }
.announce-body h2 { font-size: 21px; letter-spacing: -.3px; margin-bottom: 8px; }
.announce-body p { font-size: 14px; color: var(--muted); line-height: 1.65; white-space: pre-line; }

/* ปุ่ม pill บนหลังมืด — ใช้ได้ทั้งธีมสว่าง/มืดเพราะลอยบน backdrop ดำเสมอ */
.announce-pill {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 36px; padding: 7px 12px;
    font-size: 12.5px; font-weight: 500; color: rgba(255, 255, 255, .9);
    background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--radius-sm);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    cursor: pointer; user-select: none;
    transition: background .25s ease, transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.announce-pill:hover { background: rgba(0, 0, 0, .5); }
.announce-close-row { display: flex; justify-content: flex-end; position: relative; z-index: 10; }
.announce-skip-row { display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; }
.announce-skip-row input[type="checkbox"] {
    width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex: none;
}

/* แถบนำทางสไลด์ (หลายประกาศ) */
.announce-nav { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; z-index: 10; }
.announce-arrow { font-size: 18px; line-height: 1; min-width: 44px; justify-content: center; padding-inline: 12px; }
.announce-counter { min-height: 36px; cursor: default; color: rgba(255,255,255,.75); }
.announce-counter b { color: #fff; font-weight: 700; }

.announce-stage { position: relative; max-width: 100%; }
.announce-card { display: none; }
.announce-card.is-active { display: block; }

/* footer: skip checkbox + Telegram */
.announce-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: fit-content; max-width: 100%; margin-inline: auto; }

/* ปุ่มเข้ากลุ่ม Telegram — ฟ้า TrueMoney/Telegram */
.announce-tg {
    background: #229ED9; border-color: rgba(255, 255, 255, .2); color: #fff;
    text-decoration: none; font-weight: 600;
}
.announce-tg:hover { background: #1c8ec4; }
.announce-tg svg { width: 16px; height: 16px; flex: none; }

body.announce-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .announce-col { transition: none; }
}

/* ============================================================
   NOTICE MODAL — ป็อปอัปแจ้งเตือนสำคัญกลางจอ (asklepios-inspired)
   backdrop มืดเบลอ · chip ไอคอนใหญ่ · หัวข้อ/ข้อความ/ปุ่ม pill
   ============================================================ */
.notice-backdrop {
    position: fixed; inset: 0; z-index: 400;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10, 11, 14, .45);
    -webkit-backdrop-filter: blur(6px) saturate(1.1);
    backdrop-filter: blur(6px) saturate(1.1);
    padding: 22px;
    opacity: 0; transition: opacity .25s var(--ease-out);
}
.notice-backdrop.open { opacity: 1; }
.notice-modal {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 34px 28px 26px;
    text-align: center;
    transform: translateY(14px) scale(.95); opacity: 0;
    transition: transform .32s var(--ease-spring), opacity .25s var(--ease-out);
    position: relative; overflow: hidden;
}
.notice-backdrop.open .notice-modal { transform: translateY(0) scale(1); opacity: 1; }
/* glow อ่อนๆ ด้านบนการ์ดตามชนิด */
.notice-modal::before {
    content: ''; position: absolute; top: -70px; left: 50%; transform: translateX(-50%);
    width: 320px; height: 150px; border-radius: 50%; filter: blur(46px); pointer-events: none;
    background: var(--primary-soft);
}
.notice-success::before { background: var(--success-soft); }
.notice-error::before   { background: var(--danger-soft); }
.notice-warning::before { background: var(--warn-soft); }
.notice-info::before    { background: var(--primary-soft); }

.notice-icon {
    position: relative;
    width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent), 0 10px 26px -10px color-mix(in srgb, currentColor 35%, transparent);
    animation: noticeIconPop .55s var(--ease-spring) .1s both;
}
.notice-icon svg.icon { width: 36px; height: 36px; }
.notice-success .notice-icon { background: var(--success-soft); color: var(--success); }
.notice-error   .notice-icon { background: var(--danger-soft);  color: var(--danger); }
.notice-warning .notice-icon { background: var(--warn-soft);    color: var(--warn); }
.notice-info    .notice-icon { background: var(--primary-soft); color: var(--primary); }
@keyframes noticeIconPop { from { transform: scale(.3) rotate(-16deg); opacity: 0; } 60% { transform: scale(1.14) rotate(5deg); opacity: 1; } to { transform: scale(1) rotate(0); } }

.notice-title { position: relative; font-size: 19px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 7px; }
.notice-text { position: relative; font-size: 14px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; white-space: pre-line; }
.notice-actions { position: relative; display: flex; gap: 10px; margin-top: 22px; }
.notice-actions .btn { flex: 1; border-radius: 999px; }
.notice-close {
    position: absolute; top: 14px; right: 14px; z-index: 1;
    background: none; border: none; cursor: pointer; color: var(--muted-2);
    padding: 7px; border-radius: 9px; line-height: 0; transition: color .15s ease, background .15s ease;
}
.notice-close svg.icon { width: 16px; height: 16px; }
.notice-close:hover { color: var(--text); background: var(--surface-hover); }
@media (prefers-reduced-motion: reduce) {
    .toast-icon, .notice-icon { animation: none; }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap {
    min-height: calc(100vh - 220px);
    display: flex; align-items: center; justify-content: center;
    padding: 52px 20px; position: relative; overflow: hidden;
}
.scene-decor { position: absolute; inset: 0; pointer-events: none; }
.scene-decor .orb-1 { top: -160px; left: -120px; }
.scene-decor .orb-2 { bottom: -140px; right: -100px; top: auto; }
.auth-card {
    width: 100%; max-width: 440px; padding: 8px;
    border-radius: var(--radius-xl); position: relative; z-index: 1;
    box-shadow: var(--shadow-lg);
}
.auth-head { text-align: center; padding: 30px 12px 6px; }
.auth-head .brand-mark { width: 46px; height: 46px; font-size: 22px; margin-bottom: 15px; border-radius: 15px; }
.auth-head h1 { font-size: 23px; margin-bottom: 5px; letter-spacing: -.4px; }
.auth-head p { font-size: 14px; color: var(--muted); }
.auth-foot { text-align: center; padding: 18px; font-size: 14px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12.5px; padding: 0 24px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.setup-note { padding: 16px 24px 24px; font-size: 13px; color: var(--muted); }
/* Cloudflare Turnstile — จัด widget (300px) ให้กึ่งกลางการ์ด */
.auth-card .cf-turnstile { display: flex; justify-content: center; margin: 2px 0; }

/* ============================================================
   KEY CREATED
   ============================================================ */
.key-created {
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    background:
        radial-gradient(420px 130px at 90% 0%, var(--success-soft), transparent 70%),
        var(--surface);
    margin-bottom: 20px; padding: 24px;
    border-radius: var(--radius-lg);
}
.key-created h3 { margin-bottom: 4px; }
.key-reveal {
    display: flex; align-items: center; gap: 12px; margin-top: 14px;
    background: var(--surface-2); border: 1.5px dashed color-mix(in srgb, var(--success) 45%, transparent);
    border-radius: var(--radius); padding: 13px 16px;
}
.key-reveal code { flex: 1; word-break: break-all; font-size: 13px; color: var(--success); font-weight: 500; }

/* ============================================================
   POOL PICKER
   ============================================================ */
.pool-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pool-option input { display: none; }
.pool-option-body {
    display: flex; align-items: center; gap: 10px; padding: 13px 15px;
    border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: border-color .2s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out); position: relative;
}
.pool-option-body:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--surface-hover); }
.pool-option input:checked + .pool-option-body {
    border-color: var(--primary); background: var(--primary-soft);
    box-shadow: 0 0 0 4px var(--primary-ring);
    transform: translateY(-1px);
}
.pool-option input:checked + .pool-option-body::after {
    content: '✓'; position: absolute; top: -7px; right: -7px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--ink); color: var(--ink-contrast);
    font-size: 11px; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-xs);
}
.pool-icon { font-size: 19px; }

/* ---------- Brand logos (auto จากชื่อ Pool) ---------- */
.pool-logo { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; }
.pool-logo svg { width: 100%; height: 100%; display: block; }
.pool-logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 4px; }
.pool-logo.size-sm { width: 18px; height: 18px; font-size: 15px; }
.pool-logo.size-md { width: 30px; height: 30px; font-size: 24px; }
.pool-logo.size-lg { width: 38px; height: 38px; font-size: 28px; }
.pool-logo.brand-openai, .pool-logo.brand-xai { color: var(--text); }
.pool-icon .pool-logo, .feature-icon .pool-logo { color: var(--text); }
.badge .pool-logo.size-sm { width: 13px; height: 13px; }
.pool-cell { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Check rows (ตั้งค่า) ---------- */
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; font-size: 14px; font-weight: 500; }
.check-row input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Announcement bar ---------- */
.announce-bar {
    background: var(--ink);
    color: var(--ink-contrast); text-align: center;
    padding: 8px 20px; font-size: 13.5px; font-weight: 500;
}

/* ============================================================
   TOPUP
   ============================================================ */
.channel-tabs { display: flex; gap: 8px; padding: 18px 22px 0; flex-wrap: wrap; }
.channel-tab {
    flex: 1; min-width: 118px; padding: 11px; border-radius: 999px;
    border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
    font-family: var(--font); font-weight: 600; font-size: 13.5px; color: var(--muted);
    transition: border-color .18s var(--ease-out), background .18s var(--ease-out), color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.channel-tab:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); color: var(--text); }
.channel-tab.active {
    border-color: var(--ink); background: var(--ink); color: var(--ink-contrast);
    box-shadow: var(--shadow-sm);
}
.channel-body { padding: 22px; }
.amount-input { display: flex; align-items: center; gap: 4px; }
.amount-input span { font-size: 21px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.amount-input input { font-size: 22px; font-weight: 700; }
.quick-amounts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.qr-box {
    text-align: center; margin-top: 24px; padding: 26px;
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    background:
        radial-gradient(320px 120px at 50% 0%, var(--primary-soft), transparent 70%),
        var(--surface);
    animation: popIn .3s var(--ease-spring) both;
}
.qr-box img {
    width: 250px; height: 250px; object-fit: contain; border-radius: var(--radius);
    background: #fff; border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.qr-status { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 18px; text-align: left; }
.qr-amount {
    margin-top: 14px; font-size: 26px; font-weight: 700; letter-spacing: -.5px;
    background: linear-gradient(120deg, var(--grad-a), var(--grad-b));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.spinner {
    width: 22px; height: 22px; flex-shrink: 0;
    border: 3px solid var(--primary-soft); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .8s linear infinite;
}
.slip-upload {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 24px 16px; text-align: center; cursor: pointer;
    border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, var(--border));
    border-radius: var(--radius-lg); background: var(--surface-2);
    transition: border-color .15s, background .15s, transform .15s;
}
.slip-upload:hover, .slip-upload.dragover {
    border-color: var(--primary); background: var(--primary-soft);
}
.slip-upload.has-file { border-style: solid; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.slip-upload input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.slip-upload-icon .icon { width: 30px; height: 30px; color: var(--muted); transition: color .15s; }
.slip-upload:hover .slip-upload-icon .icon, .slip-upload.dragover .slip-upload-icon .icon { color: var(--primary); }
.slip-upload-text { font-size: 13.5px; color: var(--muted); word-break: break-all; }
.slip-upload.has-file .slip-upload-text { color: var(--text); font-weight: 600; }
.slip-preview {
    max-width: 100%; max-height: 200px; object-fit: contain;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: #fff; box-shadow: var(--shadow-xs);
}
.callout {
    padding: 13px 17px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 16px;
    background: var(--primary-soft); color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.callout-info { color: var(--primary); }

/* ============================================================
   FILTERS / PAGINATION
   ============================================================ */
.filter-form { display: flex; gap: 8px; align-items: center; }
.filter-form select, .filter-form input[type=search] { width: auto; min-width: 170px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
    padding: 6px 15px; border-radius: 999px; font-size: 13px; font-weight: 600;
    color: var(--muted); border: 1px solid var(--border); background: var(--surface);
    transition: color .18s var(--ease-out), border-color .18s var(--ease-out), background .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.filter-tab:hover { color: var(--text); border-color: var(--border-strong); }
.filter-tab.active {
    background: var(--ink);
    border-color: transparent; color: var(--ink-contrast);
    box-shadow: var(--shadow-sm);
}
.pagination { display: flex; gap: 6px; justify-content: center; padding: 20px; flex-wrap: wrap; }
.page-link {
    min-width: 35px; height: 35px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 999px;
    font-size: 13.5px; color: var(--muted); background: var(--surface);
    transition: border-color .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out), background .18s var(--ease-out);
}
.page-link:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.page-link.active {
    background: var(--ink);
    border-color: transparent; color: var(--ink-contrast); font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   DOCS / CODE
   ============================================================ */
.doc-card { padding: 0 0 8px; margin-bottom: 22px; overflow: hidden; }
.doc-card h2 { font-size: 18px; padding: 20px 24px 0; letter-spacing: -.3px; }
.doc-card > *:not(h2) { margin: 14px 24px 0; }
.doc-card > .table-wrap { margin: 16px 0 20px; }
.steps { padding-left: 22px; }
.steps li { margin: 9px 0; }
.code-block {
    background: #16171D; color: #DEDEF4;
    border: 1px solid #26272E;
    font-family: var(--font-mono); font-size: 13px; line-height: 1.75;
    padding: 19px 22px; border-radius: var(--radius);
    overflow-x: auto; white-space: pre; margin-bottom: 22px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.copyable { cursor: pointer; background: var(--primary-soft); color: var(--primary); padding: 3px 11px; border-radius: 7px; transition: background .18s var(--ease-out), color .18s var(--ease-out), box-shadow .18s var(--ease-out); }
.copyable:hover { box-shadow: 0 0 0 3px var(--primary-ring); }

/* ============================================================
   ERROR PAGES
   ============================================================ */
.error-page { text-align: center; padding: 110px 20px; position: relative; }
.error-code {
    font-size: 96px; font-weight: 700; line-height: 1; letter-spacing: -3px;
    background: linear-gradient(120deg, var(--grad-a), var(--grad-b), var(--grad-c));
    background-size: 200% auto;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: gradientFlow 5s linear infinite;
}
.error-page h2 { margin: 18px 0 7px; }
.error-page p { margin-bottom: 26px; color: var(--muted); }

/* ============================================================
   UTILITIES
   ============================================================ */
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.small { font-size: 12.5px; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 22px; }
.mb-3 { margin-bottom: 15px; }
.m-3 { margin: 15px; }
.my-3 { margin: 15px 0; }
.ml-auto { margin-left: auto; }
.inline { display: inline; }
.icon-sm { width: 14px !important; height: 14px !important; vertical-align: -.15em; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* แถบลบหลายรายการ + checkbox หน้าชื่อโมเดล (หน้า Admin → Models) */
.bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pick-all {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: 13.5px; color: var(--text); cursor: pointer;
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); transition: border-color .18s var(--ease-out), background .18s var(--ease-out);
    user-select: none;
}
.pick-all:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.pick-all input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
.model-pick {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; vertical-align: middle;
}
.model-pick input[type="checkbox"] {
    width: 15px; height: 15px; flex: none; cursor: pointer;
    accent-color: var(--primary); margin: 0;
    transition: transform .15s var(--ease-out);
}
.model-pick:hover input[type="checkbox"] { transform: scale(1.15); }
.model-pick:hover strong { color: var(--primary); }
.table-models .row-actions { flex-wrap: nowrap; justify-content: flex-end; }

/* กล่องบัญชีรับเงินในช่องแนบสลิป (หน้าเติมเงิน) */
.acct-box { display: flex; flex-direction: column; gap: 6px; }
.acct-box > strong { display: flex; align-items: center; gap: 7px; }
.acct-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct-num {
    font-size: 19px; font-weight: 700; letter-spacing: .5px;
    padding: 5px 14px; border-radius: 9px;
    background: var(--surface); border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--border));
    color: var(--primary); cursor: copy;
}
.hidden { display: none !important; }
.pool-section { margin-bottom: 30px; }
.pool-heading {
    font-size: 19px; display: flex; align-items: center; gap: 10px; margin-bottom: 13px; letter-spacing: -.3px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .shell-content { padding: 24px 20px; }
    .topbar { padding: 13px 20px; }
}

/* ---------- แท็บเล็ต / จุดเริ่มมือถือ: sidebar กลายเป็น drawer ---------- */
@media (max-width: 920px) {
    .menu-btn { display: inline-flex; }

    /* Sidebar ลอยเป็น drawer นอกจอ  เปิดด้วย body.sidebar-open */
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
        width: 284px; transform: translateX(-105%);
        transition: transform .28s var(--ease-spring);
        box-shadow: none; height: 100dvh;
    }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }

    .two-col, .settings-grid, .topup-grid, .quick-links { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-grid-6 { grid-template-columns: repeat(3, 1fr); }
    .cat-grid { grid-template-columns: 1fr; }

    .nav-links { display: none; }
    .shell-content { padding: 18px 14px; }
    .topbar { padding: 11px 14px; }
    .page-title { font-size: 17px; }
    .balance-label { display: none; }
    .docs-link-text { display: none; }
    .hero { padding: 64px 18px 48px; }
    .hero-stats { gap: 12px; }
    .hero-stat { padding: 13px 22px; }
    .toasts { left: 12px; right: 12px; top: 12px; max-width: none; }
    .modal-backdrop { padding: 12px; }
    .table { font-size: 13.5px; }
    .table th, .table td { padding: 11px 13px; }
    .footer-inner { flex-direction: column; text-align: center; }
}

/* ---------- มือถือเล็ก ---------- */
@media (max-width: 600px) {
    :root { --nav-h: 58px; }
    .container { padding: 0 14px; }
    .brand-name { font-size: 16px; }
    .nav-actions .btn { padding: 7px 14px; font-size: 13px; }

    .stat-grid { grid-template-columns: 1fr; }
    .stat-grid-6 { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 26px; }

    .hero { padding: 48px 14px 40px; }
    .hero-title { letter-spacing: -1px; }
    .hero-sub { font-size: 15.5px; }
    .hero-badge { font-size: 12px; padding: 6px 14px; }
    .hero-stats { flex-direction: column; align-items: stretch; }
    .hero-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
    .hero-stat strong { font-size: 23px; }
    .hero-actions .btn { width: 100%; }

    .section { padding: 32px 0; }
    .feature-grid { grid-template-columns: 1fr; }
    .pool-grid { grid-template-columns: 1fr; }
    .quick-links { grid-template-columns: 1fr; }
    .cta-box { padding: 40px 18px; margin: 36px 0 40px; }

    .card-head { padding: 15px 16px; }
    .form { padding: 18px 16px; }
    .kv-table td { padding: 10px 16px; font-size: 13px; }
    .channel-tabs { padding: 14px 14px 0; }
    .channel-body { padding: 16px 14px; }
    .amount-input input { font-size: 19px; }
    .qr-box { padding: 18px; }
    .qr-box img { width: 200px; height: 200px; }
    .pool-picker { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
    .filter-form { flex-wrap: wrap; }
    .filter-form select, .filter-form input[type=search] { min-width: 0; flex: 1; }
    .doc-card h2 { font-size: 16px; padding: 16px 16px 0; }
    .doc-card > *:not(h2) { margin: 12px 16px 0; }
    .code-block { font-size: 12px; padding: 14px 16px; }
    .error-page { padding: 72px 16px; }
    .error-code { font-size: 68px; }
    .auth-wrap { padding: 28px 12px; }
    .auth-head h1 { font-size: 20px; }
    .btn-lg { padding: 13px 24px; font-size: 14.5px; }
    .modal { border-radius: var(--radius-lg); }
    .toast { padding: 13px 12px 16px; gap: 10px; }
    .toast-icon { width: 36px; height: 36px; border-radius: 11px; }
    .toast-icon svg.icon { width: 18px; height: 18px; }
    .toast-title { font-size: 13.5px; }
    .toast-msg { font-size: 12.5px; }
    .notice-modal { padding: 28px 20px 22px; }
    .notice-icon { width: 64px; height: 64px; border-radius: 20px; }
    .notice-icon svg.icon { width: 30px; height: 30px; }
    .pool-heading { font-size: 17px; }
    .side-nav a { font-size: 14px; }
    .user-email { font-size: 12px; }
}

/* ---------- Settings category cards (หน้ารวมตั้งค่าระบบ) ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cat-card {
    display: flex; align-items: flex-start; gap: 16px;
    padding: 22px; color: inherit;
    transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s ease;
}
.cat-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-sm), 0 10px 26px -10px var(--primary-ring);
    color: inherit;
}
.cat-card .feature-icon { flex: none; }
.cat-card h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.cat-card p { font-size: 13px; line-height: 1.55; }

/* ---------- Toggle switch (สวิทช์เปิด/ปิดในตาราง admin) ---------- */
.switch { display: inline-flex; align-items: center; cursor: pointer; position: relative; }
.switch-input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
    display: inline-block; width: 46px; height: 26px; border-radius: 99px;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    transition: background .22s ease, border-color .22s ease;
    pointer-events: none;
}
.switch-knob {
    display: block; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-xs);
    transform: translateX(2px); transition: transform .22s var(--ease-out);
    margin-top: 1.5px;
}
.switch .switch-input:checked ~ .switch-track { background: var(--success); border-color: transparent; }
.switch .switch-input:checked ~ .switch-track .switch-knob { transform: translateX(22px); }
.switch:hover .switch-track { border-color: color-mix(in srgb, var(--primary) 45%, var(--border-strong)); }
.tiny { font-size: 10.5px; margin-top: 2px; }

/* Free Trial modal — ป้าย FREE TRIAL เหนือหัวข้อ */
.trial-tag {
    position: relative; display: inline-block;
    font-size: 11px; font-weight: 700; letter-spacing: 2.5px;
    color: var(--primary); background: var(--primary-soft);
    padding: 5px 14px; border-radius: 99px; margin-bottom: 10px;
}

/* ---------- Live refresh (อัปเดตข้อมูลอัตโนมัติ) ---------- */
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 10px;
    border-radius: 50%;
    background: var(--success);
    vertical-align: middle;
    animation: livePulse 2.2s var(--ease-out-soft) infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); }
    50% { opacity: .55; box-shadow: 0 0 0 6px transparent; }
}
/* หลัง JS swap HTML ครั้งแรก ปิด fade-up ไม่ให้เล่นซ้ำทุกรอบ polling */
body.live-refreshed .fade-up { animation: none; }
