/* =========================================================
   TraderSite — แนวพอร์ทัลข่าว: น้ำเงินแบรนด์ + ส้มเน้น + สีประจำหมวด
   ตัวแปรทั้งหมดอยู่ที่ :root แก้ที่เดียวเปลี่ยนทั้งเว็บ (หลังบ้านใช้ตัวแปรชุดเดียวกัน)
   ========================================================= */

:root {
    /* ธีม Wongpai Trader (ดีไซน์ Figma): เขียวเข้ม + ส้มเน้น */
    --brand: #047857;
    --brand-dark: #065F46;
    --brand-wash: #ECFDF5;
    --hot: #E86F3E;
    --amber: #F59E0B;
    --green: #059669;
    --indigo: #4F46E5;

    /* แถบสีเข้ม (ส่วนเครื่องมือ, กล่องเด่น, ท้ายเว็บ) */
    --navy: #0C302A;
    --navy-2: #123D35;
    --navy-ink: #E6F2EE;
    --navy-soft: #9DB8B0;
    --deep: #092B25;
    --deeper: #081F1B;
    --mint: #6EE7B7;
    /* ชื่อตัวแปรเดิม: ใช้เป็นสีเน้น (ส้ม) */
    --gold: #E86F3E;
    --gold-ink: #B8501F;
    --gold-wash: #FFF1EA;

    --paper: #F5F7F5;
    --surface: #FFFFFF;
    --ink: #15201E;
    --ink-soft: #64706C;
    --rule: #E3E8E5;
    --accent: #0C3B32;
    --accent-ink: #FFFFFF;
    --accent-wash: #ECFDF5;
    --link: #065F46;
    --up: #059669;
    --down: #E11D48;

    --font: "Sarabun", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
    --font-head: "Prompt", "Sarabun", "Noto Sans Thai", sans-serif;
    --font-kicker: "Manrope", "Prompt", "Noto Sans Lao", sans-serif;
    --font-lo: "Noto Sans Lao", "Phetsarath OT", "Saysettha OT", "Lao UI", sans-serif;
    --measure: 42rem;
    --radius: 18px;
    --radius-sm: 12px;
    --gap: clamp(1rem, 2.6vw, 1.75rem);
    --shadow: 0 1px 2px rgba(15, 50, 42, .04), 0 10px 28px rgba(15, 50, 42, .06);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        color-scheme: dark;
        --paper: #0A1714;
        --surface: #11221E;
        --ink: #E6EFEC;
        --ink-soft: #9AAEA8;
        --rule: #22362F;
        --navy: #0B2A24;
        --navy-2: #163A33;
        --deep: #071F1A;
        --deeper: #051512;
        --accent: #10855F;
        --accent-wash: #123329;
        --brand: #34D399;
        --brand-dark: #6EE7B7;
        --brand-wash: #123329;
        --gold-wash: #3A2219;
        --gold-ink: #FF9B70;
        --link: #6EE7B7;
        --up: #34D399;
        --down: #FB7185;
        --shadow: none;
    }
}
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] {
        color-scheme: dark;
        --paper: #0A1714;
        --surface: #11221E;
        --ink: #E6EFEC;
        --ink-soft: #9AAEA8;
        --rule: #22362F;
        --navy: #0B2A24;
        --navy-2: #163A33;
        --deep: #071F1A;
        --deeper: #051512;
        --accent: #10855F;
        --accent-wash: #123329;
        --brand: #34D399;
        --brand-dark: #6EE7B7;
        --brand-wash: #123329;
        --gold-wash: #3A2219;
        --gold-ink: #FF9B70;
        --link: #6EE7B7;
        --up: #34D399;
        --down: #FB7185;
        --shadow: none;
    }


/* ภาษาลาว: ใช้ฟอนต์ลาวทั้งเนื้อหาและหัวข้อ */
html:lang(lo) { --font: var(--font-lo); --font-head: var(--font-lo); --font-kicker: "Manrope", var(--font-lo); }
/* โลโก้ภาษาลาว: Noto Sans Lao มีถึงน้ำหนัก 700 (800 จะถูกทำตัวหนาเทียม) */
html:lang(lo) .brand-text b { font-weight: 700; letter-spacing: 0; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; width: min(76rem, 100% - 2 * var(--gap)); }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.35; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

a { color: var(--link); text-underline-offset: .2em; }
a:hover { color: var(--brand-dark); }

:focus-visible { outline: 3px solid var(--hot); outline-offset: 2px; border-radius: 4px; }
/* Blazor ย้ายโฟกัสไปที่หัวข้อหลังเปลี่ยนหน้า (ช่วยโปรแกรมอ่านหน้าจอ) ไม่ต้องแสดงกรอบ */
h1:focus, h1:focus-visible, [tabindex="-1"]:focus { outline: none; }
img { max-width: 100%; height: auto; }

.wrap { width: min(76rem, 100% - 2 * var(--gap)); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--hot); color: #fff; padding: .5rem 1rem; z-index: 30; }
.skip-link:focus { left: 1rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }

.empty, .empty-panel {
    margin: .5rem 0 0; padding: 1.75rem 1.5rem; text-align: center; color: var(--ink-soft);
    border: 1.5px dashed var(--rule); border-radius: var(--radius); background: var(--surface);
}

/* ---------- ปุ่ม ---------- */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.75rem;
    background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 12px;
    padding: .55rem 1.3rem; font-family: var(--font-head); font-weight: 600; font-size: .98rem; line-height: 1.3;
    transition: transform .15s, background .15s, box-shadow .15s;
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover { filter: brightness(1.08); color: var(--accent-ink); }
.button[disabled] { opacity: .6; cursor: progress; }
.button-hot, .button-gold { background: var(--hot); color: #fff; box-shadow: 0 5px 15px rgba(232, 111, 62, .25); }
.button-hot:hover, .button-gold:hover { background: #D96031; filter: none; transform: translateY(-1px); }
.button-hot:hover, .button-gold:hover { color: #fff; }
.button-light { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.button-light:hover { color: var(--ink); border-color: var(--brand); filter: none; }
.button-quiet { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.button-quiet:hover { color: var(--ink); border-color: var(--ink-soft); filter: none; }
.button-ghost { background: transparent; color: var(--navy-ink); border-color: rgba(232, 238, 246, .35); }
.button-wide { width: 100%; margin-top: .5rem; }

.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.link-button:hover { color: var(--ink); }
.link-button.danger { color: var(--down); }
.link-button[disabled] { opacity: .6; cursor: progress; }

/* ---------- แถบบนสุด ---------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--rule); font-size: .85rem; color: var(--ink-soft); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .3rem; }
.topbar-right { display: flex; align-items: center; gap: 1.25rem; }
.account-links { display: flex; align-items: center; gap: .9rem; }
.account-links form { margin: 0; }
.account-links a { color: var(--brand); font-weight: 600; text-decoration: none; }

.lang-switch { display: flex; gap: .15rem; }
.lang-switch a { color: var(--ink-soft); text-decoration: none; padding: .1rem .5rem; border-radius: 999px; }
.lang-switch a:lang(lo), .lang-options a:lang(lo) { font-family: var(--font-lo); }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="true"] { background: var(--brand-wash); color: var(--brand); font-weight: 600; }
.lang-options { list-style: none; padding: 0; display: flex; gap: .75rem; margin: 0 0 1.5rem; }

/* ---------- หัวเว็บ ---------- */

.site-header { background: var(--surface); position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding-block: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--brand); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; letter-spacing: -.01em; }

.site-search { flex: 1; position: relative; }
.site-search .search-icon { position: absolute; left: 1rem; top: 50%; width: 1.1rem; height: 1.1rem; transform: translateY(-50%); fill: none; stroke: var(--ink-soft); stroke-width: 2; pointer-events: none; }
.site-search input {
    width: 100%; font: inherit; color: var(--ink); background: var(--paper);
    border: 1px solid transparent; border-radius: 999px; padding: .65rem 1.1rem .65rem 2.7rem;
}
.site-search input:focus { outline: none; border-color: var(--brand); background: var(--surface); }

/* ---------- เมนูหมวด (แถบน้ำเงิน) ---------- */

.cat-nav { background: var(--brand); }
.cat-nav-inner { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-nav a {
    flex: none; color: #fff; text-decoration: none; font-family: var(--font-head); font-weight: 500; font-size: .98rem;
    padding: .75rem 1rem; white-space: nowrap;
}
.cat-nav a:hover { background: var(--brand-dark); color: #fff; }
.cat-nav a.active { background: var(--brand-dark); box-shadow: inset 0 -3px 0 var(--amber); }
.cat-nav-mobile { display: none !important; }
.cat-nav-desktop { overflow: visible; }

/* เมนูย่อย: เปิดเมื่อชี้เมาส์ หรือกด (โฟกัส) บนจอสัมผัส */
.nav-drop { position: relative; display: flex; }
.nav-drop-btn {
    font: inherit; font-family: var(--font-head); font-weight: 500; color: #fff; background: none; border: 0; cursor: pointer;
    display: flex; align-items: center; gap: .35rem; padding: .75rem 1rem; font-size: .98rem; white-space: nowrap;
}
.nav-drop-btn::after { content: ""; width: .4rem; height: .4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .8; }
.nav-drop:hover .nav-drop-btn, .nav-drop:focus-within .nav-drop-btn { background: var(--brand-dark); }
.nav-drop.active .nav-drop-btn { background: var(--brand-dark); box-shadow: inset 0 -3px 0 var(--amber); }
.nav-drop-panel {
    position: absolute; top: 100%; left: 0; z-index: 40; min-width: 14rem; display: none; padding: .4rem;
    background: var(--surface); border-radius: 0 0 var(--radius-sm) var(--radius-sm); box-shadow: 0 14px 30px rgba(10, 18, 32, .22);
}
.nav-drop:hover .nav-drop-panel, .nav-drop:focus-within .nav-drop-panel { display: grid; }
.cat-nav .nav-drop-panel a { color: var(--ink); padding: .55rem .8rem; border-radius: 6px; white-space: nowrap; }
.cat-nav .nav-drop-panel a:hover { background: var(--brand-wash); color: var(--brand); }
.cat-nav .nav-drop-panel a.active { background: var(--brand-wash); color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }

.mobile-menu { display: none; }

main { padding-block: var(--gap) calc(var(--gap) * 2.5); }

/* ---------- หน้าแรก: ข่าวเด่น ---------- */

.portal-hero {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: 12.5rem 12.5rem;
    gap: .75rem; margin-bottom: 1.1rem;
}
.story {
    position: relative; overflow: hidden; border-radius: var(--radius); text-decoration: none; color: #fff;
    display: flex; flex-direction: column; justify-content: flex-end; background: var(--navy);
}
.story:hover { color: #fff; }
.story-lead { grid-column: span 2; grid-row: span 2; }
.story-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(10, 18, 32, .82)); }
.story-body { position: relative; z-index: 1; display: grid; gap: .35rem; padding: .9rem 1rem; }
.story-lead .story-body { padding: 1.4rem 1.5rem; }
.story-tag { justify-self: start; background: var(--hot); font-size: .8rem; font-weight: 600; padding: .05rem .6rem; border-radius: 4px; }
.story-title { font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; line-height: 1.4; }
.story-lead .story-title { font-size: clamp(1.35rem, 2.4vw, 1.8rem); line-height: 1.35; }
.story-meta { font-size: .85rem; color: #C9D6E8; }
.story:hover .story-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }

/* รูปปก + บล็อกสีแทนรูป */
.thumb { display: block; background: var(--brand-wash); object-fit: cover; }
.thumb-fallback { position: relative; overflow: hidden; }
.story-img.thumb-fallback { position: absolute; }
.thumb-fallback svg { position: absolute; inset: 18% 8% 22%; width: 84%; height: 60%; }
.thumb-fallback path { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.thumb-navy { background: #123A6B; } .thumb-navy path { stroke: var(--amber); }
.thumb-orange { background: var(--hot); } .thumb-orange path { stroke: #FFE1D8; }
.thumb-green { background: var(--green); } .thumb-green path { stroke: #C9F2E2; }
.thumb-indigo { background: var(--indigo); } .thumb-indigo path { stroke: #C9CFFF; }
.thumb-amber { background: var(--amber); } .thumb-amber path { stroke: #7A4A00; }
.story-img.thumb-fallback path, .card-img.thumb-fallback path, .mini-img.thumb-fallback path, .row-thumb.thumb-fallback path { stroke-width: 3; }

.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: 1.25rem; }
.chip-label { font-family: var(--font-head); font-weight: 600; margin-right: .25rem; }
.chip { background: var(--surface); border: 1px solid var(--rule); color: var(--ink); text-decoration: none; padding: .2rem .85rem; border-radius: 999px; font-size: .92rem; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

.welcome { background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: clamp(1.75rem, 5vw, 3rem); margin-bottom: 1.25rem; }
.welcome h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); color: #fff; }
.welcome p { color: var(--navy-soft); max-width: 36rem; font-size: 1.1rem; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }

/* ---------- หน้าแรก: คอลัมน์ ---------- */

.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; }
.portal-main, .portal-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }

.box { background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.25rem 1.25rem; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: .5rem; margin-bottom: 1rem; border-bottom: 3px solid var(--brand); }
.box-head h2 { margin: 0; font-size: 1.3rem; }
.box-head a { font-size: .92rem; text-decoration: none; }
.box-news .box-head { border-color: var(--amber); }
.box-learn .box-head { border-color: var(--green); }
.box-rank .box-title { border-bottom: 3px solid var(--hot); }
.box-title { font-size: 1.15rem; margin: 0 0 .4rem; padding-bottom: .45rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem 1.1rem; }
.card { display: grid; gap: .45rem; align-content: start; text-decoration: none; color: var(--ink); }
.card-img { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); }
.card-title { font-family: var(--font-head); font-weight: 500; font-size: 1.02rem; line-height: 1.45; }
.card:hover .card-title { color: var(--brand); }
.card-meta { font-size: .84rem; color: var(--ink-soft); }

.mini-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
.mini { display: flex; gap: .8rem; padding-block: .75rem; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.mini-img { width: 5.5rem; height: 3.75rem; border-radius: 6px; flex: none; }
.mini-body { display: grid; gap: .15rem; align-content: start; }
.mini-title { font-weight: 600; line-height: 1.5; }
.mini:hover .mini-title { color: var(--brand); }
.mini-meta { font-size: .84rem; color: var(--ink-soft); }

.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.rank-list li { counter-increment: rank; display: flex; gap: .75rem; padding-block: .65rem; border-bottom: 1px solid var(--rule); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before { content: counter(rank); font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; line-height: 1.1; color: var(--hot); width: 1.3rem; flex: none; }
.rank-list a { color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.5; }
.rank-list a:hover { color: var(--brand); }

.tool-links { display: grid; gap: .5rem; }
.tool-links a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .65rem .9rem; border-radius: var(--radius-sm); background: var(--brand-wash); color: var(--ink); font-weight: 600; text-decoration: none; }
.tool-links a span { color: var(--brand); font-weight: 600; font-size: .92rem; }
.tool-links a:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }

.tool-strip { display: none; }

.promo { background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: 1.25rem 1.35rem 1.4rem; }
.promo h2 { font-size: 1.12rem; color: #fff; }
.promo p { color: var(--navy-soft); }
.promo-light { background: var(--gold-wash); color: var(--ink); }
.promo-light h2 { color: var(--ink); }
.promo-light p { color: var(--ink-soft); }

/* ---------- รายการบทความ (หน้าหมวด / ค้นหา) ---------- */

.article-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); padding-inline: 1.25rem; }
.article-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem 1.25rem; padding-block: 1.05rem; border-bottom: 1px solid var(--rule); }
.article-row:last-child { border-bottom: 0; }
.article-row.has-thumb { grid-template-columns: 10rem minmax(0, 1fr); }
.article-row.has-thumb .row-thumb { grid-column: 1; grid-row: 1 / span 2; }
.article-row.has-thumb .row-date, .article-row.has-thumb .row-body { grid-column: 2; }
.row-thumb { width: 10rem; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); }
.row-date { color: var(--ink-soft); font-size: .85rem; }
.row-title { color: var(--ink); font-family: var(--font-head); font-weight: 500; font-size: 1.12rem; text-decoration: none; line-height: 1.45; }
.row-title:hover { color: var(--brand); }
.row-excerpt { color: var(--ink-soft); margin: .3rem 0 0; line-height: 1.6; }
.row-meta { margin: .45rem 0 0; font-size: .86rem; display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; }
.row-meta a { color: var(--ink-soft); }
.article-list.compact { padding-inline: 0; background: none; }
.article-list.compact .article-row { padding-block: .65rem; }
.article-list.compact .row-date { display: none; }
.article-list.compact .row-title { font-size: 1rem; }

.type { font-weight: 600; font-size: .78rem; padding: .05rem .55rem; border-radius: 4px; background: var(--brand-wash); color: var(--brand); }
.type-market_recap { background: #FFF1D6; color: #8A5600; }
.type-knowledge { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.type-review { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }

/* ---------- หัวหน้าเพจ ---------- */

.page-head { margin-bottom: calc(var(--gap) * 1.25); max-width: var(--measure); }
.page-intro { font-size: 1.12rem; color: var(--ink-soft); }
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .92rem; color: var(--ink-soft); margin-bottom: .5rem; }
.crumbs a { color: var(--ink-soft); }

.subcats { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.subcats a {
    display: inline-block; padding: .3rem .9rem; border-radius: 999px; text-decoration: none;
    color: var(--ink); background: var(--surface); border: 1px solid var(--rule);
}
.subcats a:hover { border-color: var(--brand); color: var(--brand); }

.search-page-form { display: flex; gap: .5rem; margin-top: 1rem; }
.search-page-form input, .field input, .field textarea, .field select {
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--rule); border-radius: var(--radius-sm);
    padding: .55rem .8rem; width: 100%;
}
.search-page-form input:focus, .field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0;
}
.result-count { color: var(--ink-soft); }

/* ตัวเปลี่ยนหน้า: ปุ่มเลขหน้า + ก่อนหน้า/ถัดไป */
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem; margin-top: 1.5rem; }
.pg-list { display: flex; align-items: center; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.pg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    min-width: 2.4rem; height: 2.4rem; padding: 0 .7rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--rule); color: var(--ink);
    font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none;
    transition: border-color .15s, color .15s, background .15s;
}
a.pg-btn:hover { border-color: var(--brand); color: var(--brand); }
a.pg-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pg-btn.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg-btn.is-off { opacity: .4; }
.pg-arrow span[aria-hidden], .pg-arrow > span:not(.pg-word) { font-size: 1.25rem; line-height: 1; }
.pg-gap { color: var(--ink-soft); padding: 0 .15rem; }
.pager-status { flex-basis: 100%; text-align: center; color: var(--ink-soft); font-size: .88rem; }
@media (max-width: 760px) {
    .pg-word, .pg-far { display: none; }
    .pg-btn { min-width: 2.25rem; height: 2.25rem; padding: 0 .55rem; }
}

.message-page { max-width: var(--measure); padding-block: 2rem; }

/* ---------- บทความ ---------- */

.read-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; }
.article { min-width: 0; background: var(--surface); border-radius: var(--radius); padding: clamp(1.1rem, 4vw, 2.5rem); }
.article .risk-note { max-width: none; }
.article-head { margin-bottom: 1.5rem; max-width: 46rem; }
.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .75rem; }
.cat-tag { font-family: var(--font-head); font-weight: 500; font-size: .88rem; color: #fff; text-decoration: none; padding: .15rem .75rem; border-radius: 999px; background: var(--navy); }
.cat-tag:hover { color: #fff; filter: brightness(1.1); }
.cat-tag-navy { background: #123A6B; } .cat-tag-orange { background: var(--hot); } .cat-tag-green { background: var(--green); }
.cat-tag-indigo { background: var(--indigo); } .cat-tag-amber { background: var(--amber); color: #3D2600; }
.cat-tag-amber:hover { color: #3D2600; }
.article-head h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.32; margin-bottom: .6rem; }
.article-lead { font-size: 1.2rem; line-height: 1.7; color: var(--ink-soft); margin: 0 0 1.25rem; }
.byline { display: flex; align-items: center; gap: .75rem; padding-block: .9rem; border-block: 1px solid var(--rule); }
.byline-avatar { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 600; flex: none; }
.byline-text { display: grid; line-height: 1.45; }
.byline-name { font-weight: 600; }
.byline-meta { display: flex; flex-wrap: wrap; gap: 0 1rem; font-size: .9rem; color: var(--ink-soft); }
.ai-note { font-size: .92rem; color: var(--ink-soft); background: var(--brand-wash); border-radius: var(--radius-sm); padding: .6rem .9rem; margin: 1rem 0 0; }
.cover { width: 100%; border-radius: var(--radius-sm); margin-bottom: 1.75rem; }
img.cover { height: auto; max-height: 30rem; }
.cover.thumb-fallback { aspect-ratio: 16 / 6; }

.prose { font-size: 1.12rem; line-height: 1.9; max-width: 46rem; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 2.25rem; font-size: 1.45rem; padding-left: .75rem; border-left: 4px solid var(--brand); line-height: 1.4; }
.prose h3 { margin-top: 1.75rem; font-size: 1.2rem; }
.prose a { color: var(--brand); }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .4rem; }
.prose li::marker { color: var(--brand); font-weight: 600; }
.prose blockquote { margin: 1.75rem 0; padding: .9rem 1.1rem; border-left: 4px solid var(--amber); background: #FFF6E3; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink); }
.prose blockquote p { margin: 0; }
.prose table {
    display: block; overflow-x: auto; width: 100%; border-collapse: collapse; margin: 1.75rem 0; font-size: .98rem;
}
.prose th, .prose td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.prose th { font-weight: 600; background: var(--brand-wash); }
.prose img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 1.75rem 0; }
.prose code { background: var(--brand-wash); padding: .1em .35em; border-radius: 4px; font-size: .92em; }

.sources { margin-top: 2.25rem; padding-top: 1rem; border-top: 1px solid var(--rule); max-width: 46rem; }
.sources h2 { font-size: 1.05rem; }
.sources ul { padding-left: 1.2rem; font-size: .95rem; }

.share { margin-top: 2rem; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.share h2 { font-size: 1rem; margin: 0; }
.share-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.share-links a { color: #fff; text-decoration: none; font-weight: 600; font-size: .92rem; padding: .4rem 1rem; border-radius: 999px; }
.share-links a:hover { color: #fff; filter: brightness(1.08); }
.share-fb { background: #1877F2; }
.share-line { background: #06A64C; }
.share-wa { background: #128C4A; }

.risk-note {
    margin-top: 2rem; font-size: .92rem; color: var(--ink-soft); background: var(--paper);
    border-left: 4px solid var(--hot); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: .75rem 1rem;
}
.risk-note p { margin: 0; }

.read-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.box-head a { white-space: nowrap; }

/* ---------- หน้าหมวด ---------- */

.cat-banner { position: relative; overflow: hidden; border-radius: var(--radius); color: #fff; margin-bottom: 1rem; }
.cat-banner-line { position: absolute; right: 0; top: 12%; width: 55%; height: 76%; opacity: .55; }
.cat-banner-line path { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cat-banner-body { position: relative; padding: clamp(1.25rem, 4vw, 2.25rem) clamp(1.25rem, 4vw, 2.5rem); max-width: 44rem; }
.cat-banner h1 { color: inherit; font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin: .15rem 0 .35rem; }
.cat-banner .crumbs, .cat-banner .crumbs a { color: inherit; opacity: .85; margin: 0; }
.cat-intro { font-size: 1.08rem; margin: 0; opacity: .92; }
.cat-count { margin: .6rem 0 0; font-size: .9rem; opacity: .8; }
.cat-banner.thumb-amber { color: #3D2600; }

.feature { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: var(--surface); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); }
.feature-img { width: 100%; height: 100%; min-height: 15rem; }
.feature-img.thumb-fallback path { stroke-width: 4; }
.feature-body { display: grid; align-content: center; justify-items: start; gap: .5rem; padding: 1.5rem 1.6rem; }
.feature-title { font-family: var(--font-head); font-weight: 600; font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.4; }
.feature:hover .feature-title { color: var(--brand); }
.feature-excerpt { color: var(--ink-soft); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.box-list .box-head { border-color: var(--brand); margin-bottom: 0; }
.article-list.compact-box { padding-inline: 0; background: none; }

/* ---------- โบรกเกอร์ ---------- */

.disclosure { font-size: .92rem; color: var(--ink-soft); background: var(--gold-wash); border-radius: var(--radius-sm); padding: .65rem .9rem; }

.broker-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; }
.broker { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.35rem 1.5rem; box-shadow: var(--shadow); }
.broker-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.broker-head h2 { margin: 0; flex: 1; }
.broker-logo { border-radius: var(--radius-sm); object-fit: contain; background: #fff; border: 1px solid var(--rule); }
.broker-rating { margin: 0; color: var(--ink-soft); display: flex; align-items: baseline; gap: .2rem; }
.broker-rating strong { font-size: 1.7rem; color: var(--brand); }

.broker-facts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .9rem 1.5rem;
    margin: 0 0 1.1rem; padding: 1rem 1.1rem; background: var(--paper); border-radius: var(--radius-sm);
}
.broker-facts dt { font-size: .85rem; color: var(--ink-soft); }
.broker-facts dd { margin: 0; font-weight: 600; }

.broker-proscons { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem 2rem; margin-bottom: 1.1rem; }
.broker-proscons h3 { margin-bottom: .25rem; }
.broker-proscons div:first-child h3 { color: var(--up); }
.broker-proscons div:nth-child(2) h3 { color: var(--gold-ink); }
.broker-proscons p { color: var(--ink-soft); margin: 0; white-space: pre-line; }

.broker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.broker-head h2 a { color: inherit; text-decoration: none; }
.broker-head h2 a:hover { color: var(--brand); }

/* ตารางเทียบโบรก (จอใหญ่) */
.broker-compare { margin-bottom: 1.5rem; }
.compare-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.compare-table th, .compare-table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.compare-table thead th { font-weight: 600; color: var(--ink-soft); font-size: .84rem; background: var(--paper); white-space: nowrap; }
.compare-table tbody tr:last-child > * { border-bottom: 0; }
.compare-table tbody tr:hover { background: var(--paper); }
.compare-table .num { text-align: right; white-space: nowrap; }
.compare-table td strong { color: var(--brand); font-size: 1.05rem; }
.cmp-name { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.cmp-name img { border-radius: 6px; background: #fff; border: 1px solid var(--rule); object-fit: contain; }
.button-small { padding: .4rem .8rem; font-size: .86rem; white-space: nowrap; }

/* หน้ารายละเอียดโบรก */
.broker-detail .broker-head h1 { margin: 0; flex: 1; }
.broker-detail .disclosure { margin: 0 0 1rem; }
.broker-detail .broker-proscons h2 { font-size: 1.05rem; margin-bottom: .25rem; }
.broker-detail .broker-proscons div:first-child h2 { color: var(--up); }
.broker-detail .broker-proscons div:nth-child(2) h2 { color: var(--gold-ink); }
.broker-check { font-size: .92rem; color: var(--ink-soft); border-left: 3px solid var(--gold); padding-left: .8rem; margin: 0 0 1.1rem; }
.broker-cta .button { font-size: 1.05rem; padding: .75rem 1.4rem; }
.broker-others { margin: 1.5rem 0; }
.broker-others ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; }
.broker-others li { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.broker-others li span { color: var(--brand); font-weight: 700; }

/* ---------- เครื่องคำนวณ Lot ---------- */

.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(var(--gap) * 1.5); align-items: start; margin-bottom: calc(var(--gap) * 1.5); }
.calc-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.5rem; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: .35rem; }
.calc-inputs .field input { font-size: 1.2rem; font-weight: 600; width: 100%; }
.hint { font-size: .9rem; color: var(--ink-soft); margin: .4rem 0 0; line-height: 1.6; }

.calc-result {
    position: sticky; top: 1rem;
    background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: 1.75rem;
}
.calc-label { margin: 0; color: var(--navy-soft); }
.calc-lots { font-family: var(--font-head); font-size: clamp(3.5rem, 9vw, 5.5rem); font-weight: 700; line-height: 1; color: var(--amber); margin: .35rem 0 1.25rem; letter-spacing: -.03em; }
.calc-breakdown { margin: 0 0 1rem; }
.calc-breakdown div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .5rem; border-bottom: 1px solid rgba(233, 238, 246, .14); }
.calc-breakdown dt { color: var(--navy-soft); }
.calc-breakdown dd { margin: 0; font-weight: 600; }
.calc-result .hint { color: var(--navy-soft); }
.calc-error { color: #FFB4AC; font-weight: 600; margin: 0; }
.calc-explain { max-width: var(--measure); }

/* ---------- บัญชีสมาชิก ---------- */

.auth-card {
    max-width: 27rem; margin: 2rem auto; padding: 2rem;
    background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--brand);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-card .field { margin-bottom: 1rem; }
.auth-switch { margin: 1.25rem 0 0; color: var(--ink-soft); }

.form-error {
    background: color-mix(in srgb, var(--down) 9%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--down) 45%, transparent); border-radius: var(--radius-sm);
    padding: .75rem 1rem; margin-bottom: 1rem;
}
.form-error ul { margin: 0; padding-left: 1.2rem; }
.notice-ok {
    background: color-mix(in srgb, var(--up) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--up) 45%, transparent); border-radius: var(--radius-sm); padding: .65rem 1rem;
}

/* วิดีโอสรุปบทความ (แนวตั้ง) */
.article-video { margin: 1.25rem auto; max-width: 320px; text-align: center; }
.article-video video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #0B1730; box-shadow: var(--shadow); }
.article-video figcaption { font-size: .86rem; color: var(--ink-soft); margin-top: .5rem; }

/* สมาชิก Pro */
.pro-tag { display: inline-block; vertical-align: middle; font-size: .72rem; font-weight: 800; letter-spacing: .02em; color: #3D2A00; background: linear-gradient(135deg, #FFD36A, #FFB020); border-radius: 6px; padding: .05rem .45rem; margin-left: .35rem; }
.pro-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; max-width: 46rem; margin: 1rem 0; }
.pro-plan { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.4rem; display: flex; flex-direction: column; gap: .4rem; }
.pro-plan.is-best { border: 2px solid var(--gold); box-shadow: var(--shadow); }
.pro-plan h2 { margin: 0; font-size: 1.15rem; }
.pro-save { margin: 0; font-size: .85rem; font-weight: 700; color: var(--gold-ink); }
.pro-price { margin: .3rem 0 0; display: flex; align-items: baseline; gap: .35rem; }
.pro-price strong { font-size: 2rem; color: var(--ink); }
.pro-price span, .pro-alt { color: var(--ink-soft); font-size: .9rem; }
.pro-alt { margin: 0 0 .6rem; }
.pro-plan .button { margin-top: auto; text-align: center; }
.pro-note { max-width: 46rem; }
.pro-compare { max-width: 46rem; margin: 1.25rem 0; }
.pro-compare td { text-align: center; font-weight: 700; }
.pro-upsell, .pro-paywall {
    border: 1px dashed var(--gold); background: var(--gold-wash); border-radius: var(--radius);
    padding: 1rem 1.25rem; margin: 1rem 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
}
.pro-upsell p { margin: 0; flex: 1 1 18rem; }
.pro-paywall { flex-direction: column; align-items: flex-start; position: relative; }
.pro-paywall::before { content: ""; position: absolute; left: 0; right: 0; top: -5rem; height: 5rem; background: linear-gradient(transparent, var(--paper)); pointer-events: none; }
.pro-paywall h2 { margin: 0; }
.pro-paywall p { margin: 0; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.pay-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.pay-choice { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .6rem; }
.pay-amount-label { margin: .6rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.pay-amount { margin: 0 0 .8rem; font-size: 2rem; font-weight: 800; }
.pay-step { display: flex; align-items: center; gap: .5rem; font-size: 1.02rem; margin: .4rem 0 .7rem; }
.pay-step span { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: .85rem; flex: none; }
.pay-qr { display: block; width: 100%; max-width: 280px; height: auto; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--rule); }
.pay-to { font-weight: 600; margin: .5rem 0 0; }
.pay-form input[type=file] { width: 100%; }
.pay-form .button { margin-top: .4rem; }
.pay-history { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.pay-history li { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .55rem .8rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.pay-st { font-weight: 700; }
.pay-st-pending { color: var(--gold-ink); }
.pay-st-approved { color: var(--up); }
.pay-st-rejected { color: var(--down); }
.me-plan { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .8rem 1.1rem; margin-bottom: 1rem; }
.me-plan p { margin: 0; }
.me-plan.is-pro { border-color: var(--gold); background: var(--gold-wash); }
.journal-breakdowns-3 { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

/* หน้าบัญชีของฉัน */
.me-head { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 1.25rem; }
.me-head h1 { margin: 0; }
.me-head p { margin: .15rem 0 0; overflow-wrap: anywhere; }
.me-avatar {
    flex: none; width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand); color: #fff; font-size: 1.5rem; font-weight: 700;
}
.me-overview, .me-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.me-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem; display: flex; flex-direction: column; }
.me-card h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
.me-card form { display: flex; flex-direction: column; flex: 1; }
.me-card form .button { align-self: flex-start; margin-top: auto; }
.me-card .field input, .me-card .field select { width: 100%; }
.me-meter { height: .6rem; background: var(--paper); border-radius: 99px; overflow: hidden; }
.me-meter i { display: block; height: 100%; background: var(--up); border-radius: 99px; }
.me-big { font-weight: 700; font-size: 1.1rem; margin: .6rem 0 .2rem; }
.me-more { margin-top: auto; padding-top: .6rem; font-weight: 600; }
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; }
.me-stats dt { font-size: .82rem; color: var(--ink-soft); }
.me-stats dd { margin: 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.me-danger { border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); border-radius: var(--radius); padding: .8rem 1.25rem; margin: 1rem 0 2rem; background: var(--surface); }
.me-danger summary { cursor: pointer; font-weight: 700; color: var(--down); }
.me-danger[open] summary { margin-bottom: .6rem; }
.me-danger form { max-width: 24rem; }
.me-check { display: flex; gap: .5rem; align-items: flex-start; margin: 0 0 1rem; }
.me-check input { margin-top: .3rem; }
.button-danger { background: var(--down); color: #fff; }
.button-danger:hover { color: #fff; }
a.mp-account-name { color: inherit; text-decoration: none; }

/* ---------- บันทึกเทรด ---------- */

.pos { color: var(--up); }
.neg { color: var(--down); }

.journal-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.journal-head h1 { margin-bottom: .2rem; }
.journal-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.journal-section { margin-bottom: calc(var(--gap) * 1.5); }
/* สถิติกับกราฟอยู่คู่กัน เห็นภาพรวมในจอแรก */
.journal-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.journal-top .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.journal-top .stat-main { grid-column: 1 / -1; }

.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 1px; margin: 0; background: var(--rule);
    border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--surface); padding: .95rem 1.1rem; }
.stat dt { font-size: .88rem; color: var(--ink-soft); }
.stat dd { margin: .15rem 0 0; font-size: 1.35rem; font-weight: 700; }
.stat-main { grid-column: span 2; background: var(--navy); }
.stat-main dt { color: var(--navy-soft); }
.stat-main dd { font-size: 2.3rem; line-height: 1.2; }
.stat-main dd.pos { color: #5FD3A0; }
.stat-main dd.neg { color: #FF958A; }
.stat-main dd:not(.pos):not(.neg) { color: #fff; }

.equity-chart {
    display: block; width: 100%; height: 14rem;
    background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.equity-zero { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.equity-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.equity-line.pos { stroke: var(--up); }
.equity-line.neg { stroke: var(--down); }
.equity-axis { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-soft); margin-top: .3rem; }

.journal-breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem; margin-bottom: calc(var(--gap) * 1.5); }
.journal-breakdowns h2 { font-size: 1.1rem; }

.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.journal-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.journal-table th, .journal-table td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.journal-table th { font-weight: 600; color: var(--ink-soft); font-size: .86rem; background: var(--paper); }
.journal-table tr:last-child td { border-bottom: 0; }
.journal-table .num { text-align: right; }
.journal-table.compact td, .journal-table.compact th { padding: .45rem .75rem; }
.side { font-weight: 600; }
.side-buy { color: var(--up); }
.side-sell { color: var(--down); }
.badge-sync {
    display: inline-block; margin-left: .4rem; padding: 0 .45rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; background: var(--gold-wash); color: var(--gold-ink);
}

.trade-form { max-width: 48rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0 1.25rem; }
.trade-form .field { margin-bottom: 1rem; }
.form-note { margin: .5rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.form-actions { display: flex; align-items: center; gap: 1.5rem; margin-top: 1.5rem; }
.plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.plain-fieldset[disabled] input { opacity: .7; }

.segmented { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; background: var(--surface); }
.segmented button { font: inherit; font-weight: 600; border: 0; padding: .45rem 1.4rem; background: transparent; color: var(--ink-soft); cursor: pointer; }
.segmented .side-buy[aria-checked="true"] { background: var(--up); color: #fff; }
.segmented .side-sell[aria-checked="true"] { background: var(--down); color: #fff; }

.trade-form .select { width: 100%; }
.checkbox-row { display: flex; align-items: flex-start; gap: .6rem; }
.checkbox-row input { margin-top: .45rem; width: 1.05rem; height: 1.05rem; flex: none; accent-color: var(--brand); }
.checkbox-row label { font-weight: 500; }

/* ---------- เชื่อมบัญชีเทรด ---------- */

.account-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; }
.account-card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1.5rem; align-items: center;
    background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.25rem;
}
.account-name { margin: 0; font-weight: 700; }
.account-main p { margin: 0; }
.account-status { display: grid; justify-items: end; gap: .1rem; text-align: right; }
.account-hint { grid-column: 1 / -1; margin: 0; font-size: .92rem; color: var(--ink-soft); }
.account-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.sync-status { font-weight: 600; }
.sync-active { color: var(--up); }
.sync-pending, .sync-syncing { color: var(--gold-ink); }
.sync-error, .sync-auth_failed { color: var(--down); }

.sync-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: calc(var(--gap) * 1.5); align-items: start; }
.sync-help { display: grid; gap: 1.25rem; }
.sync-help h2 { font-size: 1.05rem; }
.sync-help ol { padding-left: 1.2rem; margin: 0 0 .5rem; }
.sync-help li { margin-bottom: .4rem; }
.security-note { background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: 1.1rem 1.35rem; }
.security-note h2 { color: var(--amber); }
.security-note p { margin: 0; color: var(--navy-soft); }

/* ---------- Footer ---------- */

.site-footer { background: var(--navy); color: var(--navy-soft); font-size: .92rem; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1.6fr); gap: 1.5rem 3rem; padding-block: 2.5rem; }
.footer-brand { font-family: var(--font-head); font-weight: 600; color: #fff; font-size: 1.15rem; margin-bottom: .35rem; }
.footer-nav { display: grid; gap: .35rem; align-content: start; }
.footer-nav a { color: var(--navy-ink); text-decoration: none; }
.footer-nav a:hover { color: var(--amber); }
.footer-legal p { line-height: 1.65; }
.footer-copy { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 .75rem; }
.footer-links a { color: var(--navy-ink); text-decoration: none; font-size: .88rem; }
.footer-links a:hover { color: var(--amber); }

/* หน้ากฎหมาย */
.legal-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.legal-nav a { display: block; padding: .5rem .75rem; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.legal-nav a:hover { background: var(--brand-wash); color: var(--brand); }
.legal-nav a[aria-current="page"] { background: var(--brand); color: #fff; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000; background: var(--down); color: #fff; padding: .75rem 1.25rem; }
#blazor-error-ui a { color: #fff; margin-left: 1rem; }
#blazor-error-ui .dismiss { position: absolute; right: 1rem; top: .75rem; }

/* ---------- แท็บเล็ต ---------- */

@media (max-width: 1024px) {
    .portal-grid { grid-template-columns: minmax(0, 1fr); }
    .portal-side { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
    .header-cta { display: none; }
}

@media (max-width: 900px) {
    .journal-top { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .read-grid { grid-template-columns: minmax(0, 1fr); }
    .feature { grid-template-columns: minmax(0, 1fr); }
    .feature-img { min-height: 0; aspect-ratio: 16 / 9; }
    .calc, .sync-grid { grid-template-columns: 1fr; }
    .calc-result { position: static; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .footer-legal { grid-column: 1 / -1; }
}

/* ---------- ข่าวด่วน: แถบบนหน้าแรก ---------- */

.breaking { display: flex; align-items: stretch; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .85rem; border: 1px solid color-mix(in srgb, #D93B3B 25%, var(--rule)); }
.breaking-label {
    flex: none; display: flex; align-items: center; gap: .4rem; background: #D93B3B; color: #fff; text-decoration: none;
    font-family: var(--font-head); font-weight: 600; padding: .45rem .9rem;
}
.breaking-label::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
.breaking-label:hover { color: #fff; }
@keyframes pulse { 50% { opacity: .25; } }
.breaking-items { list-style: none; margin: 0; padding: 0 .9rem; display: flex; gap: 1.5rem; overflow-x: auto; scrollbar-width: none; align-items: center; min-width: 0; }
.breaking-items::-webkit-scrollbar { display: none; }
.breaking-items li { flex: none; display: flex; gap: .5rem; align-items: baseline; padding-block: .45rem; max-width: 34rem; }
.breaking-items time { color: #D93B3B; font-weight: 700; font-size: .88rem; }
.breaking-items a { color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breaking-items a:hover { color: var(--brand); }

/* ---------- หัวหน้าเครื่องมือ (ปฏิทิน ข่าวด่วน) ---------- */

.tool-head { margin-bottom: 1rem; }
.tool-head h1 { margin-bottom: .25rem; font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.tool-head .page-intro { margin: 0 0 .75rem; font-size: 1rem; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cal-filters { display: grid; gap: .5rem; }
.cal-filters .chip-row { margin: 0; }
.cal-days { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .35rem; margin-bottom: .2rem; }
.cal-daychip {
    display: grid; justify-items: center; align-content: center; gap: 0; padding: .4rem .25rem; min-height: 3.2rem;
    background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; line-height: 1.3;
}
.cal-daychip:hover { border-color: var(--brand); color: var(--brand); }
.cal-daychip.is-past { opacity: .6; }
.cal-daychip.is-today { border-color: var(--hot); }
.cal-daychip.on { background: var(--brand); border-color: var(--brand); color: #fff; opacity: 1; }
.cd-wd { font-weight: 700; font-size: .9rem; }
.cd-d { font-size: .78rem; opacity: .85; }
.chip-cur { font-weight: 700; font-size: .85rem; min-width: 3.4rem; text-align: center; }
.cal-tz { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .92rem; }
.cal-tz label { font-weight: 600; }
.cal-tz select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .8rem; max-width: 100%; }

/* ---------- ปฏิทินข่าว ---------- */

.cal { display: grid; gap: 1rem; }
.cal-day { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.cal-day.is-past { opacity: .72; }
.cal-date { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: 1.02rem; padding: .7rem 1rem; border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.cal-today { background: var(--hot); color: #fff; font-size: .78rem; padding: .05rem .55rem; border-radius: 999px; }
.cal-list { display: grid; }
.ev { border-bottom: 1px solid var(--rule); }
.ev:last-child { border-bottom: 0; }
.ev-row {
    display: grid; grid-template-columns: 3.4rem 3.2rem 2.4rem minmax(0, 1fr) auto; align-items: center; gap: .3rem .75rem;
    padding: .6rem 1rem; list-style: none; cursor: pointer;
}
.ev-row::-webkit-details-marker { display: none; }
div.ev-row { cursor: default; }
.ev-row:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.ev-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-cur { font-weight: 700; font-size: .85rem; text-align: center; background: var(--paper); border-radius: 6px; padding: .1rem 0; }
.ev-imp { display: inline-flex; gap: 2px; }
.ev-imp i { width: .4rem; height: .9rem; border-radius: 2px; background: var(--rule); }
.ev-High .ev-imp i { background: #D93B3B; }
.ev-Medium .ev-imp i:nth-child(-n+2) { background: #F08A24; }
.ev-Low .ev-imp i:first-child { background: var(--amber); }
.ev-name { font-weight: 600; line-height: 1.45; display: grid; }
.ev-name small { font-weight: 400; font-size: .8rem; color: var(--ink-soft); }
.ev-High .ev-name { color: var(--ink); }
.ev-nums { display: flex; gap: .9rem; font-size: .88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-nums em { font-style: normal; color: var(--ink-soft); font-size: .78rem; margin-right: .2rem; }
.ev.is-past .ev-time { color: var(--ink-soft); }
.ev[open] .ev-row { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.ev-guide { padding: .25rem 1rem 1rem calc(1rem + 3.4rem + .75rem); }
.ev-guide dl { margin: 0; display: grid; gap: .6rem; }
.ev-guide dt { font-weight: 700; font-size: .85rem; color: var(--brand); }
.ev-guide dd { margin: .1rem 0 0; line-height: 1.65; }
.ev-effect { background: var(--brand-wash); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.cal-source { margin-top: 1rem; }

/* ---------- ข่าวแรงที่กำลังจะมา (คอลัมน์ข้าง) ---------- */

.box-events .box-title { border-bottom: 3px solid #D93B3B; }
.next-events { list-style: none; margin: 0; padding: 0; }
.next-events li { display: grid; gap: .1rem; padding-block: .55rem; border-bottom: 1px solid var(--rule); }
.ne-when { font-size: .8rem; font-weight: 700; color: var(--brand); }
.ne-when.soon { color: #D93B3B; }
.ne-name { font-weight: 600; line-height: 1.45; }
.ne-name b { font-size: .8rem; background: var(--paper); border-radius: 4px; padding: 0 .3rem; margin-right: .2rem; }
.ne-time { font-size: .8rem; color: var(--ink-soft); }
.ne-all { display: inline-block; margin-top: .6rem; font-size: .9rem; font-weight: 600; text-decoration: none; }

/* ---------- หน้าข่าวด่วน ---------- */

.flash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.flash { background: var(--surface); border-radius: var(--radius); padding: .9rem 1.1rem; border-left: 4px solid var(--rule); scroll-margin-top: 1rem; }
.flash-5 { border-left-color: #D93B3B; }
.flash-4 { border-left-color: #F08A24; }
.flash:target { box-shadow: 0 0 0 2px var(--brand); }
.flash-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .82rem; color: var(--ink-soft); }
.flash-meta time { font-weight: 700; color: var(--ink); }
.flash-imp { font-weight: 700; color: #F08A24; }
.flash-5 .flash-imp { color: #D93B3B; }
.flash-asset { font-weight: 700; font-size: .75rem; background: var(--paper); border-radius: 4px; padding: 0 .35rem; color: var(--ink); }
.flash.has-img { display: grid; grid-template-columns: minmax(0, 1fr) 11rem; gap: 1rem; align-items: start; }
.flash.has-img .flash-img { grid-column: 2; grid-row: 1; }
.flash.has-img .flash-body { grid-column: 1; grid-row: 1; }
.flash-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--paper); }
.flash-effect { margin-top: .6rem; background: var(--brand-wash); border-radius: var(--radius-sm); padding: .55rem .8rem; }
.flash-effect-label { display: block; font-weight: 700; font-size: .8rem; color: var(--brand); }
.flash-effect p { margin: .1rem 0 0; line-height: 1.65; }
.flash-title { font-size: 1.12rem; margin: .3rem 0 .2rem; line-height: 1.45; }
.flash-summary { margin: 0; line-height: 1.7; }
.flash-source { margin: .45rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .85rem; }
.flash-source a { color: var(--brand); }
.flash-ai { color: var(--ink-soft); }

/* ---------- เวลาตลาด ---------- */

.hours-now { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2.5rem; background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: 1.1rem 1.4rem; margin-bottom: 1rem; }
.hours-clock { display: grid; }
.hours-clock strong { font-family: var(--font-head); font-size: 2.6rem; line-height: 1.1; color: #fff; font-variant-numeric: tabular-nums; }
.hours-now .muted { color: var(--navy-soft); }
.hours-state p { margin: .2rem 0 0; }
.hours-open-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.hours-pill { color: #fff; font-weight: 600; padding: .15rem .8rem; border-radius: 999px; }
.hours-weekend { color: var(--amber); font-weight: 600; }
.s-sydney { --s: #0E9F6E; } .s-tokyo { --s: #D93B3B; } .s-london { --s: #2F3E9E; } .s-newyork { --s: #0A6FD6; }
.hours-pill, .tl-bar, .mh-dot { background: var(--s); }
.hours-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.hours-card { background: var(--surface); border-radius: var(--radius); padding: .9rem 1rem; border-top: 4px solid var(--rule); }
.hours-card.is-open { border-top-color: var(--s); }
.hours-card header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.hours-card h2 { margin: 0; font-size: 1.1rem; }
.hours-badge { font-size: .78rem; font-weight: 700; padding: .05rem .55rem; border-radius: 999px; background: var(--paper); color: var(--ink-soft); }
.hours-card.is-open .hours-badge { background: var(--s); color: #fff; }
.hours-time { font-family: var(--font-head); font-size: 1.35rem; font-weight: 600; margin: .35rem 0 .1rem; font-variant-numeric: tabular-nums; }
.hours-card p.small { margin: .15rem 0 0; }

.hours-timeline { margin-bottom: 1rem; }
.tl { display: grid; gap: .45rem; }
.tl-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); align-items: center; gap: .6rem; }
.tl-name { font-size: .88rem; font-weight: 600; }
.tl-track { position: relative; height: 1.4rem; background: var(--paper); border-radius: 6px; }
.tl-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; opacity: .9; }
.tl-overlap { background: repeating-linear-gradient(45deg, var(--hot), var(--hot) 6px, #FF7A5C 6px, #FF7A5C 12px); }
.tl-axis .tl-track { background: none; height: 1.6rem; }
.tl-tick { position: absolute; top: .2rem; transform: translateX(-50%); font-size: .72rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tl-tick:first-of-type { transform: none; }
.tl-tick:nth-last-of-type(2) { transform: translateX(-100%); }
.tl-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); transform: translateX(-1px); pointer-events: none; }
.hours-overlap-note { margin: .75rem 0 0; font-size: .92rem; }

.box-hours .box-title { border-bottom: 3px solid var(--indigo); }
.mh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.mh-list li { display: flex; align-items: center; gap: .55rem; font-size: .95rem; color: var(--ink-soft); }
.mh-list li.is-open { color: var(--ink); font-weight: 600; }
.mh-dot { width: .6rem; height: .6rem; border-radius: 50%; opacity: .3; }
.mh-list li.is-open .mh-dot { opacity: 1; }
.mh-state { margin-left: auto; font-size: .82rem; }

/* ---------- ชุดเครื่องคิดเลข ---------- */

.calc-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.calc-tabs button.chip { font: inherit; cursor: pointer; }
.calc-inputs select { width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .55rem .7rem; }
.calc-inputs .field-wide { grid-column: 1 / -1; margin: 0; }
.calc-lots.pos { color: #5FD3A0; }
.calc-lots.neg { color: #FF958A; }

/* ---------- ราคาสด / ค่าเงินแข็งอ่อน ---------- */

.ticker { background: var(--navy); }
.ticker-inner {
    overflow: hidden; padding-block: .4rem;
    /* จางที่ขอบซ้าย-ขวา ไม่ให้ตัวเลขดูถูกตัดขาด */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}
.ticker-track { display: flex; width: max-content; animation: ticker-run 45s linear infinite; }
.ticker-set { display: flex; gap: 1.4rem; padding-right: 1.4rem; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes ticker-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
    .ticker-inner { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: none; mask-image: none; }
    .ticker-track { animation: none; }
    .ticker-set[aria-hidden="true"] { display: none; }
}
.tk { flex: none; display: flex; align-items: baseline; gap: .4rem; color: var(--navy-ink); text-decoration: none; font-size: .88rem; font-variant-numeric: tabular-nums; }
.tk b { color: #fff; font-weight: 700; }
.tk i { font-style: normal; font-weight: 600; font-size: .8rem; }
.tk.up i { color: #5FD3A0; }
.tk.down i { color: #FF958A; }
.tk:hover b { color: var(--amber); }

.strength { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.strength li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 4.4rem; align-items: center; gap: .6rem; }
.st-cur { font-weight: 700; }
.st-track { position: relative; height: .9rem; background: var(--paper); border-radius: 999px; }
.st-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--rule); }
.st-bar { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.strength .up .st-bar { left: 50%; background: var(--up); }
.strength .down .st-bar { right: 50%; background: var(--down); }
.st-val { text-align: right; font-weight: 600; font-size: .9rem; font-variant-numeric: tabular-nums; }
.strength .up .st-val { color: var(--up); }
.strength .down .st-val { color: var(--down); }
.strength.is-compact { gap: .3rem; }
.strength.is-compact li { grid-template-columns: 2.6rem minmax(0, 1fr) 3.6rem; }
.strength.is-compact .st-val { font-size: .8rem; }
.st-updated { margin: .75rem 0 0; }
.box-strength .box-title { border-bottom: 3px solid var(--green); }
.price-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.price-table th, .price-table td { padding: .45rem .3rem; border-bottom: 1px solid var(--rule); text-align: left; }
.price-table tr:last-child th, .price-table tr:last-child td { border-bottom: 0; }
.price-table .num { text-align: right; }
.price-table .pos { color: var(--up); font-weight: 600; }
.price-table .neg { color: var(--down); font-weight: 600; }

/* ---------- เส้นทางเรียน + แบบทดสอบ ---------- */

.learn-hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem 2rem; background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2rem); margin-bottom: 1rem; }
.learn-hero h1 { color: #fff; margin: 0 0 .3rem; font-size: clamp(1.6rem, 3.8vw, 2.3rem); }
.learn-hero p { margin: 0; color: var(--navy-soft); max-width: 36rem; }
.learn-hero a:not(.button) { color: var(--amber); }
.learn-progress { display: grid; gap: .5rem; min-width: min(100%, 17rem); }
.learn-progress strong { color: #fff; }
.lp-track { height: .55rem; background: rgba(255, 255, 255, .15); border-radius: 999px; overflow: hidden; }
.lp-bar { display: block; height: 100%; background: var(--amber); border-radius: 999px; }
.learn-badge { display: flex; align-items: center; gap: 1rem; background: #FFF6E3; border: 1px solid var(--amber); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; color: #3D2600; }
.learn-badge h2 { margin: 0; font-size: 1.15rem; color: inherit; }
.learn-badge p { margin: .1rem 0 0; }
.lb-medal { width: 3rem; height: 3rem; border-radius: 50%; background: var(--amber); color: #fff; display: grid; place-items: center; font-size: 1.6rem; flex: none; }
.learn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; counter-reset: none; }
.lesson { display: grid; grid-template-columns: 2.8rem minmax(0, 1fr); gap: .9rem; align-items: start; background: var(--surface); border-radius: var(--radius); padding: .9rem 1.1rem; border: 2px solid transparent; }
.lesson.is-next { border-color: var(--hot); }
.lesson-step { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; background: var(--brand-wash); color: var(--brand); }
.lesson.is-done .lesson-step { background: var(--up); color: #fff; }
.lesson-body { display: grid; gap: .2rem; text-decoration: none; color: var(--ink); }
.lesson-title { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; line-height: 1.4; }
.lesson-body:hover .lesson-title { color: var(--brand); }
.lesson-excerpt { color: var(--ink-soft); line-height: 1.6; }
.lesson-score { font-size: .85rem; font-weight: 600; color: var(--up); }
.lesson-lang { font-size: .82rem; color: var(--ink-soft); }

.lesson-bar { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .9rem; font-weight: 600; background: var(--brand-wash); border-radius: var(--radius-sm); padding: .45rem .8rem; margin-bottom: 1rem; }
.lesson-bar a { text-decoration: none; }

.quiz { margin-top: 2.25rem; padding: 1.25rem; border-radius: var(--radius); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--rule)); }
.quiz h2 { margin: 0 0 .2rem; font-size: 1.3rem; }
.quiz-list { margin: 1rem 0; padding-left: 1.3rem; display: grid; gap: 1.1rem; }
.quiz-text { font-weight: 600; margin: 0 0 .5rem; line-height: 1.55; }
.quiz-options { display: grid; gap: .4rem; }
.quiz-opt {
    display: flex; align-items: flex-start; gap: .6rem; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
    background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .55rem .75rem; line-height: 1.5;
}
.quiz-opt:hover:not([disabled]) { border-color: var(--brand); }
.quiz-opt[disabled] { cursor: default; }
.quiz-letter { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .85rem; background: var(--paper); }
.quiz-opt.chosen { border-color: var(--brand); background: var(--brand-wash); }
.quiz-opt.chosen .quiz-letter { background: var(--brand); color: #fff; }
.quiz-opt.right { border-color: var(--up); background: color-mix(in srgb, var(--up) 12%, var(--surface)); }
.quiz-opt.right .quiz-letter { background: var(--up); color: #fff; }
.quiz-opt.wrong { border-color: var(--down); background: color-mix(in srgb, var(--down) 10%, var(--surface)); }
.quiz-opt.wrong .quiz-letter { background: var(--down); color: #fff; }
.quiz-explain { margin: .45rem 0 0; font-size: .92rem; line-height: 1.6; padding-left: .7rem; border-left: 3px solid var(--rule); }
.quiz-explain.ok { border-left-color: var(--up); }
.quiz-explain.no { border-left-color: var(--down); }
.quiz-left { margin-left: .75rem; }
.quiz-result { display: grid; gap: .3rem; padding: .9rem 1rem; border-radius: var(--radius-sm); }
.quiz-result.pass { background: color-mix(in srgb, var(--up) 14%, var(--surface)); }
.quiz-result.fail { background: color-mix(in srgb, var(--amber) 18%, var(--surface)); }
.quiz-result strong { font-family: var(--font-head); font-size: 1.25rem; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }

/* ---------- คุกกี้ ---------- */

.consent {
    position: fixed; left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 80; max-width: 40rem; margin-inline: auto;
    background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(10, 18, 32, .3);
    padding: 1rem 1.1rem; display: grid; gap: .75rem; border: 1px solid var(--rule);
}
.consent[hidden] { display: none; }
.consent p { margin: 0; font-size: .92rem; line-height: 1.6; }
.consent-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.footer-consent { color: inherit; font-size: inherit; }

/* ---------- เมนูมือถือ (แผงเลื่อนจากขวา) ---------- */

.mobile-backdrop {
    position: fixed; inset: 0; z-index: 90; background: rgba(10, 18, 32, .55);
    animation: mp-fade .2s ease-out;
}
.mobile-panel {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 91; width: min(88vw, 23rem);
    background: var(--paper); overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column; gap: .9rem;
    padding: .75rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
    box-shadow: -18px 0 40px rgba(10, 18, 32, .25);
    animation: mp-slide .24s cubic-bezier(.2, .8, .2, 1);
}
.mobile-panel > * { flex-shrink: 0; }
@keyframes mp-slide { from { transform: translateX(100%); } }
@keyframes mp-fade { from { opacity: 0; } }
body:has(.mobile-menu[open]) { overflow: hidden; }

.mp-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .25rem; }
.mp-head .brand-mark { width: 2.1rem; height: 2.1rem; border-radius: 9px; }
.mp-head .brand-mark svg { width: 1.2rem; height: 1.2rem; }
.mp-head .brand-name { font-size: 1.25rem; }
.mp-close {
    width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink);
    display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 3px rgba(22, 36, 58, .12);
}
.mp-close svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.mp-search { position: relative; }
.mp-search svg { position: absolute; left: .95rem; top: 50%; width: 1.05rem; height: 1.05rem; transform: translateY(-50%); fill: none; stroke: var(--ink-soft); stroke-width: 2; pointer-events: none; }
.mp-search input {
    width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
    border: 1px solid var(--rule); border-radius: 12px; padding: .75rem 1rem .75rem 2.6rem;
}
.mp-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }

.mp-cta {
    display: flex; align-items: center; gap: .6rem; background: var(--navy); color: #fff; text-decoration: none;
    font-family: var(--font-head); font-weight: 500; padding: .8rem 1rem; border-radius: 12px;
}
.mp-cta:hover { color: #fff; }
.mp-cta-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 4px rgba(255, 90, 54, .25); flex: none; }

.mp-label { margin: .35rem 0 -.4rem; font-size: .82rem; font-weight: 600; color: var(--ink-soft); }

.mp-list { display: grid; background: var(--surface); border-radius: 14px; overflow: hidden; }
.mp-list a {
    display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; color: var(--ink); text-decoration: none;
    font-family: var(--font-head); font-weight: 500; font-size: 1.02rem; border-bottom: 1px solid var(--rule);
}
.mp-list a:last-child { border-bottom: 0; }
.mp-list a::after {
    content: ""; margin-left: auto; width: .5rem; height: .5rem; flex: none;
    border-top: 2px solid var(--ink-soft); border-right: 2px solid var(--ink-soft); transform: rotate(45deg); opacity: .6;
}
.mp-list a:active { background: var(--brand-wash); }
.mp-ico { width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; flex: none; }
.mp-ico svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mp-red { background: #D93B3B; } .mp-blue { background: var(--brand); }
.mp-navy { background: #123A6B; } .mp-green { background: var(--green); } .mp-indigo { background: var(--indigo); }
.mp-amber { background: var(--amber); } .mp-amber svg { stroke: #3D2600; } .mp-orange { background: var(--hot); }

.mp-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.mp-tiles a {
    display: grid; justify-items: center; gap: .4rem; text-align: center; padding: .85rem .4rem .75rem;
    background: var(--surface); border-radius: 14px; color: var(--ink); text-decoration: none;
    font-size: .86rem; font-weight: 600; line-height: 1.3;
}
.mp-tiles a:active { background: var(--brand-wash); }
.mp-tiles svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.mp-foot { margin-top: auto; display: grid; gap: .85rem; padding-top: .5rem; }
.mp-join { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.mp-auth { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.mp-auth .button { justify-content: center; text-align: center; }
.mp-account { display: flex; align-items: center; gap: .7rem; background: var(--surface); border-radius: 14px; padding: .7rem .9rem; }
.mp-account form { margin: 0 0 0 auto; }
.mp-avatar { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.mp-account-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-foot .lang-switch { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: 999px; padding: 4px; }
.mp-foot .lang-switch a { text-align: center; padding: .45rem .5rem; }
.mp-foot .lang-switch a[aria-current="true"] { background: var(--brand); color: #fff; }

/* ---------- มือถือ ---------- */

@media (max-width: 760px) {
    .me-stats dd { font-size: 1.05rem; }
    .me-card form .button { align-self: stretch; }
    .broker-compare { display: none; }
    .broker-cta .button { width: 100%; text-align: center; }
    body { font-size: 1rem; }
    .topbar { display: none; }
    .header-inner { gap: .75rem; padding-block: .6rem; }
    .brand { flex: 1; }
    .brand-mark { width: 2.25rem; height: 2.25rem; border-radius: 10px; }
    .brand-name { font-size: 1.35rem; }
    .site-search { display: none; }

    .mobile-menu { display: block; }
    .mobile-menu summary {
        list-style: none; cursor: pointer; width: 2.75rem; height: 2.75rem; border-radius: 50%;
        background: var(--brand); color: #fff; display: grid; place-items: center;
    }
    .mobile-menu summary::-webkit-details-marker { display: none; }
    .mobile-menu summary:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
    .mobile-menu-icon, .mobile-menu-icon::before, .mobile-menu-icon::after {
        display: block; width: 1.05rem; height: 2px; background: currentColor; border-radius: 2px; position: relative;
    }
    .mobile-menu-icon::before, .mobile-menu-icon::after { content: ""; position: absolute; left: 0; }
    .mobile-menu-icon::before { top: -6px; }
    .mobile-menu-icon::after { top: 6px; }

    /* เมนูหมวดเป็นแถบเลื่อนแบบชิป */
    .cat-nav-desktop { display: none !important; }
    .cat-nav-mobile { display: flex !important; }
    .cat-nav-inner { width: 100%; padding: .5rem var(--gap); gap: .35rem; }
    .cat-nav a { padding: .3rem .9rem; border-radius: 999px; font-size: .92rem; }
    .cat-nav a.active { background: #fff; color: var(--brand); box-shadow: none; }

    main { padding-top: .85rem; }
    .portal-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 14rem 8.5rem 8.5rem; gap: .6rem; }
    .story-lead { grid-column: 1 / -1; grid-row: auto; }
    .story-lead .story-body { padding: 1rem 1.1rem; }
    .story-lead .story-title { font-size: 1.25rem; }
    .story-title { font-size: .92rem; }
    .story-body { padding: .7rem .8rem; }
    .chip-row { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gap)); padding-inline: var(--gap); scrollbar-width: none; }
    .chip-row::-webkit-scrollbar { display: none; }
    .chip, .chip-label { flex: none; }

    .box { padding: .95rem 1rem 1.1rem; border-radius: var(--radius-sm); }
    .card-title { font-size: .95rem; }
    .portal-side { grid-template-columns: 1fr; }

    .article-list { padding-inline: 1rem; }
    .article-row.has-thumb { grid-template-columns: minmax(0, 1fr) 6.5rem; }
    .article-row.has-thumb .row-thumb { grid-column: 2; grid-row: 1 / span 2; width: 6.5rem; }
    .article-row.has-thumb .row-date, .article-row.has-thumb .row-body { grid-column: 1; }
    .row-excerpt { display: none; }
    .row-title { font-size: 1.02rem; }

    /* บทความบนมือถือ: เต็มจอ อ่านสบาย */
    .read-grid { margin-inline: calc(-1 * var(--gap)); gap: .85rem; }
    .read-main { gap: .85rem; }
    .read-grid .portal-side, .read-main .related, .read-grid > .legal-nav { margin-inline: var(--gap); }
    .article { border-radius: 0; padding: 1.1rem var(--gap) 1.5rem; }
    .article-head h1 { font-size: 1.6rem; }
    .article-lead { font-size: 1.05rem; }
    .cover { margin-inline: calc(-1 * var(--gap)); width: calc(100% + 2 * var(--gap)); border-radius: 0; }
    .cover.thumb-fallback { aspect-ratio: 16 / 8; }
    .prose { font-size: 1.06rem; line-height: 1.85; }
    .prose h2 { font-size: 1.28rem; }
    .share { flex-direction: column; align-items: stretch; }
    .share-links a { flex: 1; text-align: center; }
    .crumbs { font-size: .86rem; }

    .cat-banner { border-radius: var(--radius-sm); }
    .cat-banner-line { width: 70%; opacity: .35; }
    .feature-body { padding: 1rem 1.1rem 1.2rem; }
    .feature-excerpt { -webkit-line-clamp: 2; }


    /* ---------- ลดความยาวหน้าบนมือถือ ---------- */
    .portal-hero { grid-template-rows: 12.5rem; grid-auto-rows: 7.25rem; }

    /* การ์ดข่าว / อ่านต่อ: ปัดซ้ายขวาแทนเรียงลงล่าง */
    .card-grid {
        display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 62%;
        overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: .75rem;
        margin-inline: -1rem; padding-inline: 1rem; scroll-padding-inline: 1rem;
    }
    .card-grid::-webkit-scrollbar { display: none; }
    .card { scroll-snap-align: start; }

    /* ความรู้มือใหม่: สองแถว ปัดซ้ายขวา */
    .mini-list {
        grid-template-columns: none; grid-auto-flow: column; grid-template-rows: repeat(2, auto); grid-auto-columns: 85%;
        overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0 1rem;
        margin-inline: -1rem; padding-inline: 1rem; scroll-padding-inline: 1rem;
    }
    .mini-list::-webkit-scrollbar { display: none; }
    .mini { scroll-snap-align: start; }

    .side-tools, .side-promo, .side-desktop-only { display: none; }
    .tool-strip { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; }
    .tool-strip::-webkit-scrollbar { display: none; }
    .tool-strip a {
        flex: none; background: var(--navy); color: #fff; text-decoration: none; font-weight: 600; font-size: .92rem;
        padding: .55rem 1rem; border-radius: 999px;
    }
    .tool-strip a:first-child { background: var(--hot); }
    .rank-list li { padding-block: .5rem; }

    /* เครื่องคำนวณ Lot: ผลลัพธ์ขึ้นก่อน ช่องกรอกสองคอลัมน์ เห็นครบในจอเดียว */
    .page-head { margin-bottom: 1rem; }
    .page-head .page-intro { font-size: 1rem; }
    .calc { gap: .75rem; margin-bottom: 1.5rem; }
    .calc-result { order: -1; padding: 1rem 1.1rem; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 1rem; }
    .calc-result .calc-label { grid-column: 1 / -1; font-size: .9rem; }
    .calc-lots { font-size: 3.2rem; margin: 0; }
    .calc-breakdown { margin: 0; font-size: .86rem; }
    .calc-breakdown div { padding-block: .2rem; }
    .calc-breakdown div:nth-child(n+4) { display: none; }
    .calc-result .hint { display: none; }
    .calc-inputs { gap: .75rem .85rem; padding: 1rem; }
    .calc-inputs .field label { font-size: .9rem; line-height: 1.4; min-height: 2.8em; display: flex; align-items: flex-end; }
    .calc-inputs .field input { font-size: 1.1rem; }
    .calc-inputs .hint { font-size: .8rem; line-height: 1.45; }

    /* บันทึกเทรด: สถิติสามคอลัมน์ กราฟเตี้ยลง */
    .journal-head { margin-bottom: 1rem; }
    .journal-top .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat { padding: .6rem .7rem; }
    .stat dt { font-size: .76rem; }
    .stat dd { font-size: 1.05rem; }
    .stat-main dd { font-size: 1.8rem; }
    .equity-chart { height: 9rem; }
    .journal-section { margin-bottom: 1.25rem; }

    .auth-card { margin: .5rem auto 1rem; padding: 1.25rem; }


    /* ปฏิทินบนมือถือ: เวลา สกุลเงิน ความแรง อยู่บรรทัดบน ชื่อข่าวเต็มบรรทัด */
    .ev-row { grid-template-columns: auto auto auto 1fr; padding: .6rem .85rem; }
    .cal-filters .chip-row { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gap)); padding-inline: var(--gap); scrollbar-width: none; }
    .cal-tz select { flex: 1; min-width: 0; }
    .cal-days { display: flex; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gap)); padding-inline: var(--gap); }
    .cal-days::-webkit-scrollbar { display: none; }
    .cal-daychip { flex: 0 0 4.4rem; }
    .ev-name { grid-column: 1 / -1; }
    .ev-nums { grid-column: 1 / -1; }
    .ev-guide { padding: .2rem .85rem .9rem; }
    .breaking-items li { max-width: 80vw; }
    .hours-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hours-clock strong { font-size: 2.1rem; }
    .tl-row { grid-template-columns: 4.6rem minmax(0, 1fr); }
    .tl-name { font-size: .8rem; }
    .tl-tick:nth-child(even) { display: none; }
    /* ข่าวด่วนบนมือถือ: การ์ดย่อ รูปเล็กด้านขวา แตะเพื่ออ่านเต็มในป๊อปอัป */
    .flash-list { gap: .5rem; }
    .flash { padding: .7rem .8rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .flash:active { background: var(--paper); }
    .flash.has-img { grid-template-columns: minmax(0, 1fr) 5.5rem; gap: .7rem; }
    .flash.has-img .flash-img { grid-column: 2; grid-row: 1; aspect-ratio: 1; }
    .flash.has-img .flash-body { grid-column: 1; grid-row: 1; }
    .flash-list .flash-title { font-size: 1rem; margin: .2rem 0 .15rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .flash-list .flash-summary { font-size: .88rem; line-height: 1.55; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .flash-list .flash-effect, .flash-list .flash-source { display: none; }
    .flash-pop .flash-meta { margin-bottom: .5rem; }

    /* ---------- ปรับมือถือรอบสอง ---------- */
    /* เครื่องคิดเลข: แท็บเลื่อนแถวเดียว ผลลัพธ์เรียงลงล่าง อ่านง่าย */
    .calc-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gap)); padding-inline: var(--gap); }
    .calc-tabs::-webkit-scrollbar { display: none; }
    .calc-tabs .chip { flex: none; }
    .calc-result { display: block; }
    .calc-result .calc-label { margin-bottom: .1rem; }
    .calc-lots { font-size: clamp(2.2rem, 11vw, 2.8rem); margin: 0 0 .6rem; overflow-wrap: anywhere; }
    .calc-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; font-size: .84rem; }
    .calc-breakdown div { display: grid; gap: 0; padding-block: .35rem; }
    .calc-breakdown div:nth-child(n+4) { display: grid; }
    .calc-breakdown dd { font-size: .98rem; }
    .calc-inputs .field label, .calc-inputs .field .label { font-size: .9rem; line-height: 1.4; min-height: 2.8em; display: flex; align-items: flex-end; margin-bottom: .3rem; }
    .calc-inputs .segmented { width: 100%; }
    .calc-inputs .segmented button { flex: 1; padding-inline: .5rem; }
    .calc-inputs select { font-size: 1rem; padding: .5rem .6rem; }

    /* เวลาตลาด: เวลาอยู่บรรทัดเดียว */
    .hours-time { font-size: 1.05rem; white-space: nowrap; }
    .hours-card { padding: .75rem .8rem; }
    .hours-card h2 { font-size: 1rem; }

    /* ปฏิทิน: ปุ่ม "ทั้งสัปดาห์" ไม่ตัดบรรทัด */
    .cal-daychip:first-child { flex-basis: auto; padding-inline: .7rem; }
    .cal-daychip .cd-wd { white-space: nowrap; }

    /* ท้ายเว็บ: ลิงก์สองคอลัมน์ ไม่ยาวเป็นแถวเดียว */
    .footer-nav { display: none; }   /* มือถือมีเมนูล่างและปุ่มเมนูแล้ว */
    .account-card { grid-template-columns: 1fr; }
    .account-status { justify-items: start; text-align: left; }
    .broker { padding: 1.1rem; }
}

@media (max-width: 520px) {
    .search-page-form { flex-direction: column; }
    .footer-inner { grid-template-columns: 1fr; }
    .welcome-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ---------- ป๊อปอัปกลาง (#site-modal) และกล่องยืนยัน ---------- */
.modal {
    border: 0; padding: 0; background: transparent; color: var(--ink);
    width: min(36rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: visible;
}
.modal::backdrop { background: rgba(8, 15, 30, .55); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-card {
    background: var(--surface); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    max-height: calc(100vh - 3rem); display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem .4rem; }
.modal-meta { margin: 0 0 .25rem; font-size: .86rem; color: var(--ink-soft); font-weight: 600; }
.modal-title { margin: 0; font-size: 1.2rem; line-height: 1.4; }
.modal-x {
    flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--paper); color: var(--ink); font-size: 1rem; line-height: 1;
}
.modal-x:hover { background: var(--rule); }
.modal-body { padding: .4rem 1.25rem 1.25rem; overflow-y: auto; }
.modal-body dl { margin: 0; display: grid; gap: .9rem; }
.modal-body dt { font-weight: 700; font-size: .9rem; color: var(--ink-soft); margin-bottom: .15rem; }
.modal-body dd { margin: 0; line-height: 1.65; }
.modal-body .ev-effect { background: var(--accent-wash, var(--paper)); border-radius: var(--radius-sm); padding: .7rem .85rem; }
.modal-body .ev-nums-big { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.modal-body .ev-nums-big span { background: var(--paper); border-radius: var(--radius-sm); padding: .35rem .7rem; font-weight: 700; }
.modal-body .ev-nums-big em { font-style: normal; font-weight: 400; color: var(--ink-soft); margin-right: .3rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.25rem 1.1rem; border-top: 1px solid var(--rule); }
.modal-confirm { width: min(26rem, calc(100vw - 2rem)); }
.modal-confirm .modal-body p { margin: 0; line-height: 1.6; }
.modal-danger [data-modal-ok] { background: var(--down); border-color: var(--down); color: #fff; }
/* ดูรูปขยาย */
.modal-image { width: min(70rem, calc(100vw - 1.5rem)); }
.modal-image .modal-card { background: #0B1220; color: #fff; }
.modal-image .modal-meta { display: none; }
.modal-image .modal-title { font-size: .95rem; font-weight: 500; color: #C9D6EA; }
.modal-image .modal-x { background: rgba(255, 255, 255, .12); color: #fff; }
.modal-image .modal-body { padding: 0 1rem 1rem; display: grid; place-items: center; }
.modal-image .modal-body img { max-width: 100%; max-height: calc(100vh - 8rem); width: auto; height: auto; border-radius: var(--radius-sm); background: #fff; }
.prose img, .flash img { cursor: zoom-in; }
details[data-modal] > summary { cursor: pointer; }
@media (max-width: 760px) {
    /* มือถือ: ป๊อปอัปข้อมูลเลื่อนขึ้นจากด้านล่าง */
    .modal:not(.modal-image):not(.modal-confirm) { width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: 88vh; }
    .modal:not(.modal-image):not(.modal-confirm) .modal-card { border-radius: 18px 18px 0 0; max-height: 88vh; }
    .modal:not(.modal-image):not(.modal-confirm)[open] { animation: sheet-in .2s ease-out; }
    .modal-foot .button { flex: 1; }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }

/* กล่องยืนยันในหน้าที่โต้ตอบได้ (component ConfirmDialog) */
.cd-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(8, 15, 30, .55); display: grid; place-items: center; padding: 1rem; }
.cd-card { background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); width: min(26rem, 100%); padding: 1.25rem; animation: modal-in .16s ease-out; }
.cd-card h2 { margin: 0 0 .5rem; font-size: 1.12rem; }
.cd-card p { margin: 0 0 1.1rem; line-height: 1.6; color: var(--ink-soft); }
.cd-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.cd-actions .button-danger { background: var(--down); border-color: var(--down); color: #fff; }
a.ne-name { color: inherit; text-decoration: none; }
a.ne-name:hover { color: var(--brand); }
/* ป๊อปอัปผ่านแบบทดสอบ */
.quiz-celebrate { text-align: center; }
.quiz-celebrate h2 { font-size: 1.3rem; }
.quiz-celebrate .cd-actions { justify-content: center; flex-wrap: wrap; }
.qc-ring {
    --pct: 100; width: 6.5rem; height: 6.5rem; margin: .4rem auto 1rem; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--up) calc(var(--pct) * 1%), var(--paper) 0);
}
.qc-ring span { width: 5.3rem; height: 5.3rem; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; color: var(--up); }
.modal-foot[hidden], .modal-meta[hidden] { display: none; }
.modal-body .ev-guide { padding: 0; margin: 0; border: 0; background: none; }
.modal-body .ev-nums-big { margin-top: 0; }
/* บันทึกเทรด: การ์ดเริ่มต้น (ยังไม่มีเทรด) */
.journal-start { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.journal-start h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.journal-start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.start-option { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; background: var(--paper); border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; }
.start-option h3 { margin: 0; font-size: 1.05rem; }
.start-option p { margin: 0 0 .5rem; color: var(--ink-soft); line-height: 1.6; flex: 1; }
.start-icon { font-size: 1.6rem; line-height: 1; }

/* ป๊อปอัปของส่วนที่โต้ตอบได้ (AppModal) */
.bm-backdrop {
    position: fixed; inset: 0; z-index: 1000; background: rgba(8, 15, 30, .55); backdrop-filter: blur(2px);
    display: grid; place-items: center; padding: 1rem; overflow-y: auto;
}
.bm-card { width: min(36rem, 100%); max-height: calc(100vh - 2rem); animation: modal-in .16s ease-out; outline: none; }
.bm-card.bm-wide { width: min(46rem, 100%); }
.bm-card .modal-body .trade-form { border: 0; padding: 0; box-shadow: none; background: none; margin: 0; }
.bm-card .form-actions { position: sticky; bottom: -1.25rem; background: var(--surface); padding: .8rem 0 .2rem; margin-top: .5rem; }
.security-inline { background: var(--accent-wash); border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .92rem; line-height: 1.6; margin: 0 0 1rem; }
body:has(.bm-backdrop), body:has(.cd-backdrop) { overflow: hidden; }
@media (max-width: 760px) {
    .bm-backdrop { place-items: end stretch; padding: 0; }
    .bm-card, .bm-card.bm-wide { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: sheet-in .2s ease-out; }
}
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.label-row label { margin-bottom: .35rem; }
.time-now { font-size: .85rem; white-space: nowrap; }
.trade-warn { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.tk.flash-up span { animation: tk-up 1.2s ease-out; }
.tk.flash-down span { animation: tk-down 1.2s ease-out; }
@keyframes tk-up { from { color: #2ECC71; } }
@keyframes tk-down { from { color: #FF6B6B; } }

/* บันทึกเทรด: คำนวณจากราคา */
.trade-calc { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: .2rem 0 .6rem; padding: .5rem .75rem; background: var(--paper); border-radius: var(--radius-sm); font-size: .94rem; }
.trade-calc .chip { cursor: pointer; font: inherit; font-size: .85rem; }

/* ป้ายอารมณ์/ความผิดพลาด */
.tag-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-chip { font: inherit; font-size: .9rem; cursor: pointer; border-radius: 999px; padding: .3rem .8rem; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.tag-chip:hover { border-color: var(--brand); }
.tag-chip.good.on { background: var(--up); border-color: var(--up); color: #fff; }
.tag-chip.bad.on { background: var(--down); border-color: var(--down); color: #fff; }
.tag-mini { display: inline-block; font-size: .72rem; border-radius: 999px; padding: 0 .45rem; margin: .1rem 0 0 .25rem; white-space: nowrap; }
.tag-mini.good { background: color-mix(in srgb, var(--up) 15%, transparent); color: var(--up); }
.tag-mini.bad { background: color-mix(in srgb, var(--down) 13%, transparent); color: var(--down); }

/* นิสัยการเทรด */
.habit-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.habit-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1rem; }
.habit-card.is-bad { border-left: 4px solid var(--down); }
.habit-card.is-good { border-left: 4px solid var(--up); }
.habit-card p { margin: 0; }
.habit-label { font-size: .85rem; color: var(--ink-soft); }
.habit-value { font-size: 1.35rem; font-weight: 800; margin: .15rem 0 !important; }
.habit-sub { font-size: .88rem; color: var(--ink-soft); }

/* ปฏิทินกำไร/ขาดทุน */
.pnl-cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .75rem; }
.pnl-cal-head h2 { margin: 0; }
.pnl-cal-nav { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.pnl-cal-nav a { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--rule); text-decoration: none; color: var(--ink); font-size: 1.2rem; line-height: 1; }
.pnl-cal-nav a:hover { border-color: var(--brand); color: var(--brand); }
.pnl-cal-total { margin: 0; flex-basis: 100%; }
.pnl-grid { display: grid; gap: .35rem; }
.pnl-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.pnl-dow { text-align: center; font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.pnl-cell { min-height: 4.6rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--rule); padding: .35rem .45rem; display: flex; flex-direction: column; gap: .1rem; overflow: hidden; }
.pnl-cell.is-empty { background: transparent; border-color: transparent; }
.pnl-cell.is-today { outline: 2px solid var(--brand); outline-offset: -2px; }
.pnl-cell.is-up { background: color-mix(in srgb, var(--up) calc(var(--a) * 32%), var(--surface)); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.pnl-cell.is-down { background: color-mix(in srgb, var(--down) calc(var(--a) * 30%), var(--surface)); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.pnl-day { font-size: .78rem; color: var(--ink-soft); }
.pnl-amt { font-weight: 800; font-size: .98rem; }
.is-up .pnl-amt { color: var(--up); }
.is-down .pnl-amt { color: var(--down); }
.pnl-n { font-size: .72rem; color: var(--ink-soft); }
@media (max-width: 760px) {
    .pnl-row, .pnl-grid { gap: .2rem; }
    .pnl-cell { min-height: 3.3rem; padding: .2rem .25rem; }
    .pnl-amt { font-size: .74rem; }
    .pnl-n { display: none; }
    .pnl-dow { font-size: .7rem; }
}
/* รูปกราฟในบันทึกเทรด */
.chart-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.chart-slot { background: var(--paper); border-radius: var(--radius-sm); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.chart-slot-title { margin: 0; font-weight: 700; font-size: .88rem; }
.chart-slot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; cursor: zoom-in; background: var(--surface); }
.chart-attached { margin: 0; color: var(--up); font-weight: 600; font-size: .9rem; }
.chart-upload { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; border: 2px dashed var(--rule); border-radius: 6px; color: var(--ink-soft); font-weight: 600; cursor: pointer; }
.chart-upload:hover { border-color: var(--brand); color: var(--brand); }
.chart-upload.is-busy { opacity: .6; cursor: progress; }
.chart-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.has-chart { font-size: .8rem; margin-left: .2rem; }
/* ตัวกรองบันทึกเทรด */
.journal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin: 0 0 1.25rem; padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.jf-ranges { display: flex; flex-wrap: wrap; gap: .35rem; margin-right: auto; }
.journal-filters select { font: inherit; font-size: .92rem; padding: .35rem .6rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); max-width: 12rem; }
.jf-clear { font-size: .9rem; }
@media (max-width: 760px) {
    .jf-ranges { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
    .journal-filters select { flex: 1 1 8rem; max-width: none; font-size: 16px; }
}
/* AI ทบทวนการเทรด */
.ai-review { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.ai-review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; }
.ai-review-head h2 { margin: 0; }
.ai-review-body h2 { font-size: 1.05rem; margin: 1rem 0 .35rem; }
.ai-review-body p, .ai-review-body li { line-height: 1.7; }
.video-step { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--rule); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- รายงานการเทรด ---------- */
.report-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.report-balance { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.report-balance label { font-weight: 600; font-size: .9rem; }
.report-balance input { width: 8rem; font: inherit; padding: .35rem .6rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.wl-bar { display: flex; height: 2.2rem; border-radius: 999px; overflow: hidden; margin: 1rem 0 1.25rem; font-size: .85rem; font-weight: 700; color: #fff; }
.wl-bar span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; padding: 0 .6rem; min-width: 0; flex-basis: 0; }
.wl-win { background: var(--up); }
.wl-loss { background: var(--down); }
.wl-be { background: var(--ink-soft); }
.report-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.report-group { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; }
.report-group h2 { font-size: 1rem; margin: 0 0 .6rem; color: var(--ink-soft); }
.report-group dl { margin: 0; display: grid; gap: .45rem; }
.report-group dl div { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; border-bottom: 1px dashed var(--rule); padding-bottom: .35rem; }
.report-group dl div:last-child { border-bottom: 0; }
.report-group dt { color: var(--ink-soft); font-size: .9rem; }
.report-group dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.report-group .is-main dd { font-size: 1.2rem; }
.report-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.dd-chart { width: 100%; height: 140px; display: block; background: var(--surface); border-radius: var(--radius-sm); }
.dd-area { fill: color-mix(in srgb, var(--down) 30%, transparent); stroke: var(--down); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
@media print {
    .site-header, .topbar, .cat-nav, .ticker, .site-footer, .mobile-chips, .no-print, .consent, #blazor-error-ui, .breaking-strip { display: none !important; }
    body { background: #fff; }
    .report-group, .journal-section { break-inside: avoid; }
}
/* นำเข้าไฟล์ประวัติเทรด */
.import-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.import-box h2 { font-size: 1.05rem; }
.import-drop { aspect-ratio: auto; min-height: 6rem; margin-bottom: 1rem; text-align: center; padding: 1rem; }
.import-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.import-summary div { background: var(--paper); border-radius: var(--radius-sm); padding: .55rem .7rem; }
.import-summary dt { font-size: .8rem; color: var(--ink-soft); }
.import-summary dd { margin: 0; font-weight: 700; }
.import-box .button-wide { margin-top: 1rem; }
@media (max-width: 760px) { .import-grid { grid-template-columns: 1fr; } }
/* สถานะการเชื่อมบัญชีในป๊อปอัป */
.link-progress { text-align: center; padding: 1rem 0 .5rem; }
.link-progress .spinner.big { width: 2.6rem; height: 2.6rem; border-width: 4px; display: inline-block; }
.lp-icon { display: inline-grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 50%; font-size: 1.4rem; font-weight: 800; color: #fff; }
.lp-icon.ok { background: var(--up); }
.lp-icon.bad { background: var(--down); }
.lp-title { font-size: 1.15rem; font-weight: 800; margin: .6rem 0 .2rem; }
.lp-account { color: var(--ink-soft); margin: 0 0 .5rem; }
.link-progress + .cd-actions { justify-content: center; flex-wrap: wrap; }

/* บันทึกเทรด: แท็บแบ่งส่วน ไม่ต้องเลื่อนยาว */
.jtabs {
    display: flex; gap: .25rem; margin: 0 0 1.25rem; padding: .3rem;
    background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
    overflow-x: auto; scrollbar-width: none; scroll-margin-top: 5rem;
}
.jtabs::-webkit-scrollbar { display: none; }
.jtab {
    flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .55rem 1.1rem; border-radius: 999px; color: var(--ink-soft); text-decoration: none;
    font-family: var(--font-head); font-weight: 600; white-space: nowrap; transition: background .15s, color .15s;
}
.jtab:hover { color: var(--ink); background: var(--paper); }
.jtab.on { background: var(--brand); color: #fff; }
.jtab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.jtab-n { font-family: var(--font); font-size: .78rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; background: var(--paper); color: var(--ink-soft); }
.jtab.on .jtab-n { background: rgba(255, 255, 255, .22); color: #fff; }
.jpanel[hidden] { display: none; }
@media (max-width: 760px) {
    .jtabs { display: grid; grid-template-columns: repeat(4, auto); border-radius: var(--radius); padding: .25rem; gap: .15rem; }
    .jtab { padding: .5rem .35rem; font-size: .84rem; gap: .25rem; border-radius: calc(var(--radius) - 4px); }
    .jtab-n { font-size: .68rem; padding: 0 .35rem; }
}

/* บัญชีเทรดที่เชื่อมอยู่ (ใต้หัวข้อบันทึกเทรด) */
.acct-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .65rem; }
.acct-count { font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.acct-chip {
    display: inline-flex; align-items: center; gap: .45rem; max-width: 100%;
    padding: .3rem .8rem .3rem .6rem; border-radius: 999px; font-size: .88rem;
    background: var(--surface); border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
}
.acct-chip:hover { border-color: var(--brand); }
.acct-chip strong { font-weight: 700; white-space: nowrap; }
.acct-meta { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-dot { width: .55rem; height: .55rem; border-radius: 50%; flex: none; background: var(--ink-soft); }
.acct-chip.st-active .acct-dot { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 25%, transparent); }
.acct-chip.st-pending .acct-dot, .acct-chip.st-syncing .acct-dot { background: var(--amber); animation: acct-pulse 1.2s ease-in-out infinite; }
.acct-chip.st-error .acct-dot, .acct-chip.st-auth_failed .acct-dot { background: var(--down); }
@keyframes acct-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .acct-chip .acct-dot { animation: none; } }
@media (max-width: 760px) { .acct-meta { max-width: 14rem; } }

/* ---------- มือถือแบบแอป: แถบเมนูล่าง ---------- */
.bottom-nav { display: none; }
@media (max-width: 760px) {
    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--surface) 94%, transparent);
        -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
        border-top: 1px solid var(--rule); box-shadow: 0 -6px 20px rgba(10, 18, 32, .06);
    }
    .bottom-nav a {
        display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .3rem 0 .15rem;
        color: var(--ink-soft); text-decoration: none; font-size: .72rem; font-weight: 600; line-height: 1.2;
        -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bottom-nav svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .bottom-nav a.on { color: var(--brand); }
    .bottom-nav a.on svg { stroke-width: 2.3; }
    .bottom-nav a:active { transform: scale(.94); }
    body { padding-bottom: calc(4.1rem + env(safe-area-inset-bottom)); }
    .consent { bottom: calc(4.8rem + env(safe-area-inset-bottom)); }
    #blazor-error-ui { bottom: calc(4.1rem + env(safe-area-inset-bottom)); }
}
@media print { .bottom-nav { display: none !important; } }

/* ---------- บันทึกเทรด: ตารางเป็นการ์ดบนมือถือ (แตะการ์ด = เปิดป๊อปอัป) ---------- */
@media (max-width: 760px) {
    .table-scroll:has(> .jt-cards) { background: none; border: 0; overflow: visible; }
    .jt-cards, .jt-cards tbody { display: block; }
    .jt-cards thead { display: none; }
    .jt-cards tr {
        display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .55rem;
        background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
        padding: .7rem .9rem; margin-bottom: .5rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .jt-cards tr:active { background: var(--paper); }
    .jt-cards td { padding: 0; border: 0 !important; white-space: nowrap; font-size: .88rem; }
    .jt-cards .jt-sym { order: 1; font-size: 1rem; }
    .jt-cards .jt-pl { order: 3; margin-left: auto; font-size: 1.08rem; font-weight: 700; text-align: right; }
    .jt-cards .jt-side { order: 4; flex-basis: auto; }
    .jt-cards .jt-lot { order: 5; color: var(--ink-soft); }
    .jt-cards .jt-lot::before { content: "· " attr(data-label) " "; }
    .jt-cards .jt-entry { order: 6; color: var(--ink-soft); }
    .jt-cards .jt-entry::before { content: "· "; }
    .jt-cards .jt-exit { order: 7; color: var(--ink-soft); }
    .jt-cards .jt-exit::before { content: "→ "; }
    .jt-cards .jt-r { order: 8; color: var(--ink-soft); }
    .jt-cards .jt-r::before { content: "· "; }
    .jt-cards .jt-date { order: 2; font-size: .8rem; }
    .jt-cards .jt-date a { color: var(--ink-soft); text-decoration: none; }
    .jt-cards .jt-setup { order: 9; flex-basis: 100%; white-space: normal; color: var(--ink-soft); font-size: .82rem; }
    .jt-cards .is-empty { display: none; }
    /* ป้าย "ดึงจากบัญชี" เหลือเป็นไอคอน ประหยัดที่ */
    .jt-cards .jt-sym .badge-sync { font-size: 0; padding: 0; background: none; border: 0; vertical-align: middle; }
    .jt-cards .jt-sym .badge-sync::before { content: "🔗"; font-size: .78rem; }
    /* ให้สัญลักษณ์กับกำไรอยู่บรรทัดแรก ที่เหลือขึ้นบรรทัดใหม่ */
    .jt-cards tr::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
}
.flash-pop-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: .7rem; background: var(--paper); }
.flash-pop .flash-summary { line-height: 1.75; }

/* ---------- ตัวคุมวินัย ---------- */
.guard-card {
    background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--rule);
    border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1.25rem;
}
.guard-card.is-ok { border-left-color: var(--up); }
.guard-card.is-hit { border-left-color: var(--down); background: color-mix(in srgb, var(--down) 5%, var(--surface)); }
.guard-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.guard-head h2 { margin: 0; font-size: 1.1rem; }
.guard-edit { font-size: .9rem; font-weight: 600; }
.guard-pitch { margin: 0 0 .75rem; color: var(--ink-soft); line-height: 1.6; }
.guard-stop { margin: 0 0 .75rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--down); color: #fff; font-weight: 700; line-height: 1.5; }
.guard-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem 1.25rem; }
.guard-meter { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; align-items: baseline; }
.gm-label { font-size: .85rem; color: var(--ink-soft); }
.gm-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.gm-bar { grid-column: 1 / -1; height: .45rem; border-radius: 999px; background: var(--paper); overflow: hidden; }
.gm-bar i { display: block; height: 100%; border-radius: inherit; background: var(--up); }
.guard-meter.hit .gm-bar i { background: var(--down); }
.guard-meter.hit .gm-value { color: var(--down); }
.guard-foot { margin: .7rem 0 0; }

.guard-form { display: grid; gap: .9rem; margin: .75rem 0 1rem; }
.guard-form input, .guard-form select { width: 100%; font: inherit; font-size: 16px; padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); }
.input-prefix span { padding: 0 .2rem 0 .7rem; color: var(--ink-soft); font-weight: 700; }
.input-prefix input { border: 0 !important; background: transparent !important; }
.input-prefix:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.guard-tg { border-top: 1px solid var(--rule); padding-top: .9rem; margin-bottom: .5rem; }
.guard-tg h3 { margin: 0 0 .4rem; font-size: 1rem; }
.guard-tg p { margin: 0 0 .6rem; }
.guard-tg-ok { color: var(--up); font-weight: 700; }
.guard-tg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.button-tg { background: #229ED9; border-color: #229ED9; color: #fff; }
.button-tg:hover { background: #1B8AC0; border-color: #1B8AC0; color: #fff; }
.guard-check { display: flex; align-items: flex-start; gap: .5rem; margin: 0 0 .55rem; line-height: 1.5; cursor: pointer; }
.guard-check input { width: 1.1rem; height: 1.1rem; margin-top: .2rem; flex: none; accent-color: var(--brand); }

/* ---------- ครู AI ในบทความ ---------- */
.tutor-card {
    margin: 2rem 0 1.5rem; padding: 1.1rem 1.2rem; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--brand-wash), var(--surface) 70%); border: 1px solid var(--rule);
}
.tutor-head { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: .8rem; }
.tutor-ico { font-size: 1.8rem; line-height: 1; }
.tutor-head h2 { margin: 0 0 .15rem; font-size: 1.15rem; }
.tutor-head p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.tutor-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.tutor-chips .chip { cursor: pointer; font: inherit; font-size: .9rem; }
.tutor-thread { display: flex; flex-direction: column; gap: .55rem; margin: .25rem 0 .8rem; max-height: 55vh; overflow-y: auto; }
.tutor-q {
    align-self: flex-end; max-width: 85%; padding: .55rem .85rem; border-radius: 1rem 1rem .25rem 1rem;
    background: var(--brand); color: #fff; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.tutor-a {
    align-self: flex-start; max-width: 92%; padding: .6rem .9rem; border-radius: 1rem 1rem 1rem .25rem;
    background: var(--paper); border: 1px solid var(--rule); line-height: 1.7;
}
.tutor-a > :first-child { margin-top: 0; }
.tutor-a > :last-child { margin-bottom: 0; }
.tutor-a p, .tutor-a li { font-size: .95rem; }
.tutor-empty { margin: .25rem 0; }
.tutor-typing { display: inline-flex; gap: .3rem; padding: .8rem 1rem; }
.tutor-typing i { width: .45rem; height: .45rem; border-radius: 50%; background: var(--ink-soft); animation: tutor-dot 1s infinite ease-in-out; }
.tutor-typing i:nth-child(2) { animation-delay: .15s; }
.tutor-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tutor-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .tutor-typing i { animation: none; } }
.tutor-input { display: flex; gap: .5rem; align-items: flex-end; }
.tutor-input textarea {
    flex: 1; min-width: 0; resize: none; font: inherit; font-size: 16px; line-height: 1.5;
    padding: .55rem .75rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
.tutor-input textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.tutor-chips .chip { white-space: normal; text-align: left; max-width: 100%; }

/* ---------- หน้า Pro (รอบปรับดีไซน์) ---------- */
.pro-hero {
    position: relative; overflow: hidden; margin: 0 0 1.5rem; padding: 2rem 1.6rem 1.8rem;
    border-radius: var(--radius); color: var(--navy-ink);
    background: radial-gradient(120% 140% at 100% 0%, #1F5A4C 0%, var(--navy) 55%);
}
.pro-hero::after {
    content: ""; position: absolute; right: -3rem; bottom: -4rem; width: 16rem; height: 16rem; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 176, 32, .28), transparent 70%); pointer-events: none;
}
.pro-hero-tag { display: inline-block; font-weight: 800; font-size: .78rem; letter-spacing: .08em; color: #3D2A00; background: linear-gradient(135deg, #FFD36A, #FFB020); border-radius: 6px; padding: .1rem .55rem; }
.pro-hero h1 { color: #fff; margin: .6rem 0 .5rem; font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.3; max-width: 32rem; }
.pro-hero p { margin: 0; max-width: 36rem; color: var(--navy-soft); line-height: 1.7; }
.pro-hero .pro-hero-status { margin-top: 1rem; color: #7EE2B0; font-weight: 700; }
.pro-trial { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: 1.2rem; }
.pro-trial span { color: var(--navy-soft); font-size: .9rem; }
.pro-trial-inline { margin: .75rem 0; }
.pro-trial-inline .hint { text-align: center; }

.pro-plans { max-width: 52rem; gap: 1.1rem; }
.pro-plan { position: relative; padding: 1.5rem 1.4rem 1.4rem; transition: transform .15s, box-shadow .15s; }
.pro-plan:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(10, 18, 32, .08); }
.pro-plan.is-best { border: 2px solid var(--hot); background: linear-gradient(180deg, color-mix(in srgb, var(--hot) 6%, var(--surface)), var(--surface) 45%); }
.pro-ribbon { position: absolute; top: -.75rem; right: 1.2rem; background: var(--hot); color: #fff; font-size: .78rem; font-weight: 800; padding: .2rem .7rem; border-radius: 999px; }
.pro-price strong { font-size: 2.3rem; letter-spacing: -.02em; }
.pro-plan .pro-alt { min-height: 1.4em; }
.pro-plan.is-best .pro-alt { color: var(--gold-ink); font-weight: 700; }

.pro-section-title { margin: 2.2rem 0 .9rem; font-size: 1.3rem; }
.pro-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .8rem; max-width: 52rem; }
.pro-feature { display: flex; gap: .8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; }
.pro-feature > span { font-size: 1.6rem; line-height: 1; flex: none; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 12px; background: var(--brand-wash); }
.pro-feature h3 { margin: 0 0 .2rem; font-size: 1rem; }
.pro-feature p { margin: 0; color: var(--ink-soft); font-size: .9rem; line-height: 1.6; }
.pro-compare { max-width: 52rem; }
.pro-faq { max-width: 52rem; display: grid; gap: .5rem; }
.pro-faq details { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .2rem 1rem; }
.pro-faq summary { cursor: pointer; font-weight: 700; padding: .65rem 0; }
.pro-faq details p { margin: 0 0 .8rem; color: var(--ink-soft); line-height: 1.7; }

/* ป๊อปอัปชำระเงิน */
.pay-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .25rem; padding: .25rem; background: var(--paper); border-radius: 999px; margin-bottom: .5rem; }
.pay-seg button { font: inherit; font-weight: 700; border: 0; background: none; color: var(--ink-soft); padding: .5rem .6rem; border-radius: 999px; cursor: pointer; }
.pay-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(10, 18, 32, .12); }
.pay-seg-sm button { font-size: .88rem; padding: .35rem .5rem; }
.pay-box { text-align: center; padding: .9rem 0 .5rem; }
.pay-box .pay-amount-label { margin: 0; }
.pay-box .pay-amount { margin: 0 0 .7rem; font-size: 2.1rem; }
.pay-box .pay-qr { margin: 0 auto; max-width: 240px; padding: .5rem; box-shadow: 0 6px 20px rgba(10, 18, 32, .1); }
.pay-auto { margin: .6rem 0 .15rem; color: var(--up); font-weight: 700; }
.pay-manual { margin: .6rem 0 0; color: var(--gold-ink); font-weight: 700; }
.pay-save-qr { font-size: .88rem; }
.pay-slip-drop {
    position: relative; display: flex; align-items: center; gap: .8rem; margin: .8rem 0 .2rem; padding: .9rem 1rem;
    border: 2px dashed var(--rule); border-radius: var(--radius); cursor: pointer; background: var(--surface);
}
.pay-slip-drop:hover, .pay-slip-drop:focus-within { border-color: var(--brand); }
.pay-slip-ico { font-size: 1.8rem; }
.pay-slip-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pay-slip-drop:has(input:valid) { border-style: solid; border-color: var(--up); background: color-mix(in srgb, var(--up) 6%, var(--surface)); }
@media (max-width: 760px) {
    .pro-hero { padding: 1.5rem 1.1rem; margin-inline: calc(-1 * var(--gap)); border-radius: 0; }
    .pro-plan:hover { transform: none; }
}

/* =========================================================
   ดีไซน์ใหม่ (Figma: Wongpai Trader) — หัวเว็บ แถบราคา ท้ายเว็บ เมนูล่าง
   ========================================================= */
body { background: var(--paper); }
::selection { background: #A7F3D0; color: #063A30; }

/* แถบราคาบนสุด */
.ticker { background: var(--deep); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.ticker-inner {
    display: flex; align-items: center; gap: 1.6rem; height: 2.25rem; padding-block: 0;
    -webkit-mask-image: none; mask-image: none; overflow: hidden;
}
.ticker-status { flex: none; display: flex; align-items: center; gap: .5rem; font-size: .72rem; font-weight: 600; color: #A7F3D0; }
.ticker-status i { width: .4rem; height: .4rem; border-radius: 50%; background: var(--ink-soft); }
.ticker-status.is-open i { background: #4ADE80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .12); }
.ticker-viewport {
    flex: 1; min-width: 0; overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 1.5rem, #000 calc(100% - 2rem), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 1.5rem, #000 calc(100% - 2rem), transparent);
}
.ticker-set { gap: 2rem; padding-right: 2rem; }
.tk { font-size: .72rem; font-weight: 600; color: #fff; gap: .5rem; }
.tk b { color: rgba(255, 255, 255, .7); font-weight: 700; }
.tk.up i { color: #4ADE80; }
.tk.down i { color: #FB7185; }
.tk:hover b { color: var(--mint); }
@media (prefers-reduced-motion: reduce) { .ticker-viewport { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: none; mask-image: none; } }

/* หัวเว็บ */
.site-header {
    position: sticky; top: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid color-mix(in srgb, var(--rule) 80%, transparent);
}
.header-inner { height: 4.5rem; padding-block: 0; gap: 1.75rem; justify-content: space-between; }
.brand { gap: .65rem; }
.brand-mark { width: 2.25rem; height: 2.25rem; border-radius: 12px; background: var(--deep); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.brand-mark svg { width: 1.5rem; height: 1.5rem; stroke: #fff; stroke-width: 2.5; }
.brand-mark .bm-up { stroke: #4ADE80; }
.brand-mark .bm-base { stroke-width: 2; opacity: .45; }
.brand-text { line-height: 1; display: block; }
.brand-text b { display: block; font-family: var(--font-kicker); font-weight: 800; font-size: 1.06rem; letter-spacing: -.02em; color: #0F172A; }
.brand-text small { text-transform: uppercase; }
.brand-hl { color: var(--brand); }
.brand-on-dark .brand-hl { color: #34D399; }
.brand-mark .bm-back { stroke: #6EE7B7; }
.brand-text small:empty { display: none; }
.brand-text small { display: block; margin-top: .25rem; font-family: var(--font-kicker); font-size: .56rem; font-weight: 800; letter-spacing: .24em; color: #047857; }
.brand-on-dark .brand-text b { color: #fff; }
.brand-on-dark .brand-text small { color: var(--mint); }
.brand-on-dark .brand-mark { background: #12382F; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .site-header .brand-text b, html[data-theme="auto"] .mp-head .brand-text b { color: #fff; } }
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .site-header .brand-text b, html[data-theme="dark"] .mp-head .brand-text b { color: #fff; }


.main-nav { display: flex; align-items: center; gap: 1.6rem; margin-right: auto; margin-left: 1rem; }
.main-nav > a, .main-nav .nav-drop-btn {
    font-family: var(--font); font-size: .86rem; font-weight: 600; color: #475569; text-decoration: none;
    padding: .5rem 0; background: none; border: 0; cursor: pointer; display: flex; align-items: center; gap: .3rem; white-space: nowrap;
}
.main-nav .nav-drop-btn::after { width: .32rem; height: .32rem; border-width: 1.6px; opacity: .55; }
.main-nav > a:hover, .main-nav .nav-drop:hover .nav-drop-btn, .main-nav .nav-drop:focus-within .nav-drop-btn { color: var(--brand-dark); background: none; }
.main-nav > a.active, .main-nav .nav-drop.active .nav-drop-btn { color: var(--brand-dark); background: none; box-shadow: inset 0 -2px 0 var(--brand); }
.main-nav .nav-drop-panel { top: calc(100% + .4rem); border-radius: 14px; border: 1px solid var(--rule); box-shadow: 0 18px 40px rgba(15, 50, 42, .12); }
.main-nav .nav-drop-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -.6rem; height: .6rem; }
.main-nav .nav-drop-panel a { color: var(--ink); padding: .55rem .8rem; border-radius: 9px; white-space: nowrap; text-decoration: none; font-size: .92rem; }
.main-nav .nav-drop-panel a:hover { background: var(--brand-wash); color: var(--brand-dark); }
.main-nav .nav-drop-panel a.active { background: var(--brand-wash); color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .main-nav > a, html[data-theme="auto"] .main-nav .nav-drop-btn { color: var(--ink-soft); } }
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .main-nav > a, html[data-theme="dark"] .main-nav .nav-drop-btn { color: var(--ink-soft); }


.header-actions { display: flex; align-items: center; gap: .35rem; flex: none; }
.icon-btn {
    width: 2.5rem; height: 2.5rem; border-radius: 12px; display: grid; place-items: center; color: #64748B;
    background: none; border: 0; cursor: pointer; list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: #F1F5F9; color: #0F172A; }
.icon-btn svg, .header-login svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lang-menu { position: relative; }
.lang-menu-panel {
    position: absolute; right: 0; top: calc(100% + .4rem); z-index: 40; background: var(--surface); border: 1px solid var(--rule);
    border-radius: 14px; padding: .35rem; box-shadow: 0 18px 40px rgba(15, 50, 42, .12);
}
.lang-menu-panel .lang-switch { display: grid; gap: .1rem; }
.lang-menu-panel .lang-switch a { padding: .45rem .9rem; border-radius: 9px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.lang-menu-panel .lang-switch a:hover, .lang-menu-panel .lang-switch a[aria-current] { background: var(--brand-wash); color: var(--brand-dark); }
.header-login {
    display: flex; align-items: center; gap: .45rem; padding: .5rem .75rem; border-radius: 12px; text-decoration: none;
    font-size: .9rem; font-weight: 600; color: #334155; white-space: nowrap;
}
.header-login:hover { background: #F1F5F9; color: #0F172A; }
.header-cta { display: inline-flex; margin-left: .25rem; padding-inline: 1rem; font-size: .9rem; min-height: 2.6rem; }
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .icon-btn, html[data-theme="auto"] .header-login { color: var(--ink-soft); }
    html[data-theme="auto"] .icon-btn:hover, html[data-theme="auto"] .header-login:hover { background: var(--navy-2); color: var(--ink); }
}
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .icon-btn, html[data-theme="dark"] .header-login { color: var(--ink-soft); }
    html[data-theme="dark"] .icon-btn:hover, html[data-theme="dark"] .header-login:hover { background: var(--navy-2); color: var(--ink); }


/* แทบเล็ตและมือถือ: เมนูหลักย้ายไปปุ่มเมนู */
@media (max-width: 1100px) {
    .main-nav { display: none; }
    .mobile-menu { display: block; }
    .mobile-menu summary {
        list-style: none; cursor: pointer; width: 2.5rem; height: 2.5rem; border-radius: 12px;
        background: var(--surface); color: var(--ink); border: 1px solid var(--rule); display: grid; place-items: center;
    }
    .mobile-menu summary::-webkit-details-marker { display: none; }
    .mobile-menu-icon, .mobile-menu-icon::before, .mobile-menu-icon::after {
        display: block; width: 1.05rem; height: 2px; background: currentColor; border-radius: 2px; position: relative;
    }
    .mobile-menu-icon::before, .mobile-menu-icon::after { content: ""; position: absolute; left: 0; }
    .mobile-menu-icon::before { top: -6px; }
    .mobile-menu-icon::after { top: 6px; }
    .header-cta { display: inline-flex; }
}
@media (max-width: 760px) {
    .header-inner { height: 4rem; gap: .5rem; }
    .brand { flex: 1; }
    .header-actions .icon-btn, .header-actions .lang-menu, .header-login, .header-cta { display: none; }
    .mobile-menu summary { background: var(--surface); color: var(--ink); }
}
.mp-head .brand-mark { width: 2.1rem; height: 2.1rem; border-radius: 10px; }

/* ท้ายเว็บ */
.site-footer { background: var(--deeper); color: rgba(255, 255, 255, .45); font-size: .85rem; }
.footer-top {
    display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 2.5rem;
    padding: 3rem 0 2.5rem; border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.footer-about p { margin: 1.25rem 0 0; max-width: 24rem; line-height: 1.8; }
.footer-about a { color: var(--mint); }
.footer-col { display: grid; align-content: start; gap: .75rem; }
.footer-col h3 { margin: 0 0 .3rem; font-family: var(--font); font-size: .85rem; font-weight: 700; color: #fff; }
.footer-col a { color: rgba(255, 255, 255, .45); text-decoration: none; }
.footer-col a:hover { color: var(--mint); }
.footer-bottom { display: flex; justify-content: space-between; gap: .75rem 2rem; padding: 1.5rem 0 2rem; font-size: .72rem; line-height: 1.7; color: rgba(255, 255, 255, .32); }
.footer-bottom p { margin: 0; }
.footer-risk { max-width: 42rem; text-align: right; }
.footer-bottom .link-button { color: inherit; }
@media (max-width: 900px) { .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 760px) {
    .footer-top { padding-top: 2.25rem; gap: 1.75rem 1.25rem; }
    .footer-nav { display: none; }
    .footer-bottom { flex-direction: column; padding-bottom: 6rem; }
    .footer-risk { text-align: left; }
}

/* เมนูล่างมือถือแบบลอย (สีเขียวเข้ม) */
@media (max-width: 760px) {
    .bottom-nav {
        left: .75rem; right: .75rem; bottom: calc(.65rem + env(safe-area-inset-bottom)); min-height: 4rem; padding: .35rem;
        border: 1px solid rgba(255, 255, 255, .12); border-radius: 1.15rem; background: rgba(8, 38, 32, .96);
        box-shadow: 0 12px 35px rgba(8, 31, 27, .28); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    }
    .bottom-nav a, .bottom-nav button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-width: 0;
        border: 0; background: none; font: inherit; cursor: pointer; border-radius: .85rem;
        color: rgba(255, 255, 255, .5); font-size: .66rem; font-weight: 700; padding: .3rem 0;
    }
    .bottom-nav a span, .bottom-nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bottom-nav svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .bottom-nav .on { background: rgba(255, 255, 255, .1); color: var(--mint); }
    .bottom-nav a.on svg { stroke-width: 1.9; }
    /* ท้ายเว็บเว้นที่ด้านล่างให้เมนูลอยแทน (พื้นหลังสีเข้มต่อถึงขอบจอ) */
    body { padding-bottom: 0; }
    .footer-bottom { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
}

/* หัวข้อส่วนแบบดีไซน์ใหม่ */
.section-kicker { margin: 0 0 .6rem; color: #07805F; font-family: var(--font-kicker); font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.section-title { margin: 0; color: #122722; font-family: var(--font-head); font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.35; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .section-title { color: var(--ink); } html[data-theme="auto"] .section-kicker { color: var(--mint); } }
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .section-title { color: var(--ink); } html[data-theme="dark"] .section-kicker { color: var(--mint); }


/* ---------- หน้าแรก (ดีไซน์ใหม่) ---------- */
html, body { overflow-x: clip; }
.bleed { margin-inline: calc(50% - 50vw); }
main:has(> .hm-hero) { padding-top: 0; padding-bottom: 0; }
.hm-hero { position: relative; background: #F8FAF8; }
.hm-grid-bg {
    position: absolute; inset: 0; opacity: .5; pointer-events: none;
    background-image: linear-gradient(rgba(17, 76, 63, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 76, 63, .045) 1px, transparent 1px);
    background-size: 42px 42px; -webkit-mask-image: linear-gradient(to bottom, #000, transparent 92%); mask-image: linear-gradient(to bottom, #000, transparent 92%);
}
.hm-hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 2.5rem; padding: 4rem 0 5rem; }
.hm-hero-copy { display: flex; flex-direction: column; justify-content: center; }
.hm-badge {
    display: inline-flex; align-items: center; gap: .5rem; width: fit-content; margin: 0 0 1.25rem; padding: .35rem .8rem;
    border: 1px solid #A7F3D0; background: #ECFDF5; color: #065F46; border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.hm-badge svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.hm-title { margin: 0; max-width: 42rem; font-family: var(--font-head); font-size: clamp(2.4rem, 5vw, 3.5rem); font-weight: 700; line-height: 1.16; letter-spacing: -.035em; color: #10241F; }
.hm-mark { position: relative; color: #047857; }
.hm-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.15rem; height: .5rem; border-radius: 999px; background: rgba(110, 231, 183, .35); }
.hm-lead { margin: 1.25rem 0 0; max-width: 38rem; font-size: 1rem; line-height: 2; color: #475569; }
.hm-search {
    display: flex; align-items: center; max-width: 36rem; margin-top: 2rem; padding: .35rem;
    background: #fff; border: 1px solid #E2E8F0; border-radius: 16px; box-shadow: 0 14px 40px rgba(15, 50, 42, .08);
}
.hm-search:focus-within { border-color: #34D399; }
.hm-search > svg { width: 1.25rem; height: 1.25rem; margin-left: .75rem; flex: none; fill: none; stroke: #94A3B8; stroke-width: 1.8; stroke-linecap: round; }
.hm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: .75rem; font: inherit; font-size: .92rem; color: var(--ink); }
.hm-search button { border: 0; border-radius: 12px; background: #0C3B32; color: #fff; padding: .75rem 1.25rem; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.hm-search button:hover { background: #065F46; }
.hm-popular { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.25rem; font-size: .78rem; color: #64748B; }
.hm-popular a { border: 1px solid #E2E8F0; background: #fff; color: #475569; border-radius: 999px; padding: .35rem .8rem; text-decoration: none; }
.hm-popular a:hover { border-color: #6EE7B7; color: #065F46; }

.hm-quote-wrap { position: relative; }
.hm-quote-glow { position: absolute; right: -2rem; top: -2rem; width: 9rem; height: 9rem; border-radius: 50%; background: rgba(167, 243, 208, .4); filter: blur(40px); }
.hm-quote {
    position: relative; display: block; overflow: hidden; padding: 1.75rem; border-radius: 28px; color: #fff; text-decoration: none;
    background: #0C302A; border: 1px solid rgba(255, 255, 255, .8); box-shadow: 0 30px 70px rgba(8, 46, 39, .18);
}
.hm-quote:hover { color: #fff; }
.hq-head { display: flex; justify-content: space-between; align-items: flex-start; }
.hq-sub { margin: 0; font-size: .75rem; font-weight: 600; color: rgba(167, 243, 208, .7); }
.hq-head h2 { margin: .5rem 0 0; font-size: 1.25rem; font-weight: 700; color: #fff; }
.hq-state { border-radius: 8px; background: rgba(74, 222, 128, .15); color: #6EE7B7; font-size: .75rem; font-weight: 700; padding: .25rem .6rem; }
.hq-price-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-top: 1.5rem; }
.hq-price { margin: 0; font-family: var(--font-head); font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.hq-unit { margin: .25rem 0 0; font-size: .75rem; color: rgba(255, 255, 255, .45); }
.hq-chg { margin: 0; border-radius: 8px; padding: .5rem .75rem; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.hq-chg small { font-size: .75rem; margin-left: .2rem; }
.hq-chg.up { background: rgba(74, 222, 128, .1); color: #6EE7B7; }
.hq-chg.down { background: rgba(251, 113, 133, .12); color: #FDA4AF; }
.hq-chart { display: block; width: 100%; height: 190px; margin-top: 1rem; overflow: visible; }
.hq-grid { stroke: #fff; stroke-opacity: .08; stroke-dasharray: 4 7; }
.hq-line { fill: none; stroke: #4ADE80; stroke-width: 3; stroke-linecap: round; }
.hq-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 1rem; font-size: .7rem; color: rgba(255, 255, 255, .35); }
.hq-more { color: rgba(255, 255, 255, .75); font-weight: 700; font-size: .78rem; }
.hm-next {
    position: absolute; left: -1.75rem; bottom: -1.25rem; display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem .85rem .85rem;
    background: #fff; border: 1px solid #F1F5F9; border-radius: 16px; box-shadow: 0 20px 40px rgba(15, 50, 42, .12); text-decoration: none; color: var(--ink); max-width: 20rem;
}
.hm-next-ico { width: 2.5rem; height: 2.5rem; flex: none; display: grid; place-items: center; border-radius: 12px; background: #FFF7ED; color: #EA580C; }
.hm-next-ico svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hm-next small { display: block; font-size: .65rem; font-weight: 700; color: #94A3B8; }
.hm-next b { display: block; margin-top: .1rem; font-size: .78rem; color: #1E293B; }

.hm-quick { background: #fff; border-block: 1px solid rgba(226, 232, 240, .8); }
.hm-quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-block: .75rem; }
.hm-quick-grid a { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.5rem; text-decoration: none; color: var(--ink); border-left: 1px solid #F1F5F9; }
.hm-quick-grid a:first-child { border-left: 0; }
.hm-quick-grid a:hover { background: #F8FAFC; }
.hm-quick-grid b { display: block; font-size: .9rem; }
.hm-quick-grid small { display: block; margin-top: .1rem; font-size: .66rem; color: #94A3B8; }
.hm-ico { width: 2.5rem; height: 2.5rem; flex: none; display: grid; place-items: center; border-radius: 12px; background: #ECFDF5; color: #047857; transition: background .15s, color .15s; }
.hm-ico svg { width: 1.25rem; height: 1.25rem; }
.hm-quick-grid a:hover .hm-ico { background: #047857; color: #fff; }

.hm-section { padding: 4.5rem 0 2rem; }
.hm-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.hm-sub { margin: .5rem 0 0; color: #64748B; font-size: .9rem; line-height: 1.8; }
.hm-more { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .9rem; color: #065F46; text-decoration: none; transition: gap .15s; }
.hm-more:hover { gap: .75rem; color: #065F46; }

.hm-focus { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, .8fr); grid-template-rows: auto auto; gap: 1.25rem; }
.hm-lead-card {
    position: relative; grid-row: span 2; min-height: 380px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    padding: 1.75rem; border-radius: 24px; background: #102F29; color: #fff; text-decoration: none;
}
.hm-lead-card:hover { color: #fff; }
.hm-lead-art { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; }
.hm-lead-tag { position: relative; width: fit-content; border-radius: 999px; background: var(--hot); padding: .35rem .8rem; font-size: .66rem; font-weight: 700; }
.hm-lead-body { position: relative; display: block; }
.hm-lead-body small { display: block; margin-bottom: .75rem; font-size: .75rem; color: #A7F3D0; }
.hm-lead-body b { display: block; font-family: var(--font-head); font-size: clamp(1.35rem, 2.2vw, 1.7rem); line-height: 1.35; }
.hm-lead-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: .75rem; max-width: 34rem; font-size: .88rem; line-height: 1.7; color: rgba(255, 255, 255, .6); }
.hm-lead-more { display: inline-block; margin-top: 1.25rem; font-size: .9rem; font-weight: 700; }
.hm-card {
    display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; min-height: 178px; padding: 1.25rem;
    border-radius: 22px; border: 1px solid #E2E8F0; background: #fff; text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hm-card:hover { transform: translateY(-4px); border-color: #A7F3D0; box-shadow: 0 20px 40px rgba(2, 44, 34, .05); color: var(--ink); }
.hm-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.hm-card-faint { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; color: #E2E8F0; transition: color .15s; }
.hm-card:hover .hm-card-faint { color: #A7F3D0; }
.hm-card b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .95rem; line-height: 1.6; color: #1E293B; }
.hm-card small { display: block; margin-top: .5rem; font-size: .66rem; color: #94A3B8; }
.hm-pill { display: inline-block; border-radius: 999px; padding: .25rem .65rem; font-size: .66rem; font-weight: 700; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hm-pill-1 { background: #F0F9FF; color: #0369A1; }
.hm-pill-2 { background: #F5F3FF; color: #6D28D9; }
.hm-pill-3 { background: #FFF7ED; color: #C2410C; }
.hm-pill-0 { background: #ECFDF5; color: #047857; }

.hm-tools { background: #0C302A; color: #fff; padding: 4.5rem 0; margin-top: 2.5rem; }
.hm-tools-inner { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 2.5rem; }
.hm-tools-copy { display: flex; flex-direction: column; justify-content: center; }
.hm-tools .section-kicker { color: #6EE7B7; }
.hm-tools-copy h2 { margin: 0; color: #fff; font-size: clamp(1.8rem, 3.4vw, 2.25rem); font-weight: 700; line-height: 1.3; }
.hm-tools-copy > p:not(.section-kicker) { margin: 1.25rem 0 0; max-width: 28rem; font-size: .9rem; line-height: 1.9; color: rgba(255, 255, 255, .55); }
.hm-tools-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 2rem; }
.hm-tools-points > div { display: flex; align-items: center; gap: .75rem; padding: .75rem; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .04); }
.hm-tools-points svg { width: 1.25rem; height: 1.25rem; color: #6EE7B7; display: block; }
.hm-tools-points b { display: block; font-size: .78rem; }
.hm-tools-points small { font-size: .66rem; color: rgba(255, 255, 255, .4); }

.hm-calc { background: #fff; color: #0F172A; border-radius: 28px; padding: 1.75rem; box-shadow: 0 25px 50px rgba(0, 0, 0, .25); }
.hm-calc-head { display: flex; align-items: center; gap: .75rem; padding-bottom: 1.25rem; border-bottom: 1px solid #F1F5F9; }
.hm-calc-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.hm-calc-head small { font-size: .66rem; color: #94A3B8; }
.hm-free { margin-left: auto; border-radius: 999px; background: #ECFDF5; color: #047857; padding: .25rem .75rem; font-size: .66rem; font-weight: 700; }
.hm-calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.hm-calc-grid label { font-size: .78rem; font-weight: 700; color: #475569; }
.hm-input, .hm-calc-grid select {
    margin-top: .5rem; display: flex; align-items: center; border: 1px solid #E2E8F0; background: #F8FAFC; border-radius: 12px; padding: 0 1rem;
}
.hm-input i { font-style: normal; color: #94A3B8; font-weight: 500; }
.hm-input input { width: 100%; border: 0; background: transparent; outline: 0; padding: .85rem .75rem; font: inherit; font-size: .9rem; font-weight: 700; color: #0F172A; }
.hm-input:focus-within, .hm-calc-grid select:focus { border-color: #34D399; outline: 0; }
.hm-calc-grid select { width: 100%; padding: .85rem 1rem; font: inherit; font-size: .9rem; font-weight: 700; color: #0F172A; }
.hm-calc-out { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; padding: 1rem; border-radius: 16px; background: #F2F7F5; }
.hm-calc-out > div { flex: 1; }
.hm-calc-out small { display: block; font-size: .66rem; font-weight: 700; color: #94A3B8; }
.hm-calc-out b { display: block; margin-top: .25rem; font-family: var(--font-head); font-size: 1.25rem; color: #065F46; }
.hm-calc-out b small { display: inline; font-size: .75rem; color: #065F46; }
.hm-calc-note { margin: .75rem 0 0; text-align: center; font-size: .66rem; color: #94A3B8; }
.hm-calc-note a { color: #047857; font-weight: 700; }

.hm-tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; padding: .25rem; border-radius: 12px; background: rgba(226, 232, 240, .6); }
.hm-tabs button { flex: none; border: 0; background: none; border-radius: 9px; padding: .5rem .8rem; font: inherit; font-size: .75rem; font-weight: 700; color: #64748B; cursor: pointer; }
.hm-tabs button.on { background: #fff; color: #065F46; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.hm-learn { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.hm-learn-card { position: relative; overflow: hidden; display: flex; flex-direction: column; border-radius: 22px; border: 1px solid #E2E8F0; background: #fff; text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.hm-learn-card[hidden] { display: none; }
.hm-learn-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px rgba(15, 23, 42, .05); color: var(--ink); }
.hm-learn-art { position: relative; display: block; height: 11rem; overflow: hidden; }
.hm-learn-art svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 7rem; }
.hm-art-0 { background: linear-gradient(135deg, #FEF3C7, #FFF7ED); }
.hm-art-1 { background: linear-gradient(135deg, #D1FAE5, #F0FDFA); }
.hm-art-2 { background: linear-gradient(135deg, #DBEAFE, #EEF2FF); }
.art-fill { fill: rgba(255, 255, 255, .6); }
.art-line { fill: none; stroke: rgba(4, 120, 87, .6); stroke-width: 3; }
.hm-learn-pill { position: absolute; left: 1rem; top: 1rem; background: rgba(255, 255, 255, .85); color: #065F46; }
.hm-learn-body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem; }
.hm-learn-body b { flex: 1; font-size: 1rem; line-height: 1.75; color: #1E293B; min-height: 3.5rem; }
.hm-learn-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #F1F5F9; font-size: .66rem; color: #94A3B8; }
.hm-read { font-weight: 700; color: #047857; }

.hm-cal { background: #fff; border-block: 1px solid #E2E8F0; padding: 4rem 0; margin-top: 2.5rem; }
.hm-cal-inner { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 2.5rem; }
.hm-cal .hm-sub { margin-top: 1rem; }
.hm-cal .hm-more { margin-top: 1.5rem; }
.hm-cal-table { overflow: hidden; border-radius: 22px; border: 1px solid #E2E8F0; }
.hm-cal-row { display: grid; grid-template-columns: 6.5rem 5rem minmax(0, 1fr) 5rem; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid #F1F5F9; font-size: .78rem; text-decoration: none; color: var(--ink); }
a.hm-cal-row:hover { background: #F8FAFC; }
.hm-cal-headrow { background: #F8FAFC; border-top: 0; padding-block: .75rem; font-size: .66rem; font-weight: 700; color: #94A3B8; }
.hm-cal-cur { font-weight: 700; color: #64748B; }
.hm-cal-ev { padding-right: .5rem; font-weight: 600; color: #334155; }
.hm-impact { width: fit-content; border-radius: 999px; padding: .2rem .55rem; font-size: .62rem; font-weight: 700; background: #FFFBEB; color: #B45309; }
.hm-impact.hot { background: #FFF1F2; color: #E11D48; }
.hm-cal-empty { margin: 0; padding: 1.5rem; color: #94A3B8; font-size: .85rem; }

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .hm-hero { background: var(--paper); }
    html[data-theme="auto"] .hm-title { color: var(--ink); }
    html[data-theme="auto"] .hm-lead, html[data-theme="auto"] .hm-sub { color: var(--ink-soft); }
    html[data-theme="auto"] .hm-search, html[data-theme="auto"] .hm-popular a, html[data-theme="auto"] .hm-quick, html[data-theme="auto"] .hm-card, html[data-theme="auto"] .hm-learn-card, html[data-theme="auto"] .hm-cal, html[data-theme="auto"] .hm-cal-table, html[data-theme="auto"] .hm-next { background: var(--surface); border-color: var(--rule); }
    html[data-theme="auto"] .hm-search input, html[data-theme="auto"] .hm-card b, html[data-theme="auto"] .hm-learn-body b, html[data-theme="auto"] .hm-next b, html[data-theme="auto"] .hm-cal-ev { color: var(--ink); }
    html[data-theme="auto"] .hm-quick-grid a { border-color: var(--rule); }
    html[data-theme="auto"] .hm-quick-grid a:hover, html[data-theme="auto"] a.hm-cal-row:hover, html[data-theme="auto"] .hm-cal-headrow { background: var(--navy-2); }
    html[data-theme="auto"] .hm-card-faint { color: var(--rule); }
    html[data-theme="auto"] .hm-tabs { background: var(--surface); }
    html[data-theme="auto"] .hm-tabs button.on { background: var(--navy-2); color: var(--mint); }
    html[data-theme="auto"] .hm-more, html[data-theme="auto"] .hm-read { color: var(--mint); }
}
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .hm-hero { background: var(--paper); }
    html[data-theme="dark"] .hm-title { color: var(--ink); }
    html[data-theme="dark"] .hm-lead, html[data-theme="dark"] .hm-sub { color: var(--ink-soft); }
    html[data-theme="dark"] .hm-search, html[data-theme="dark"] .hm-popular a, html[data-theme="dark"] .hm-quick, html[data-theme="dark"] .hm-card, html[data-theme="dark"] .hm-learn-card, html[data-theme="dark"] .hm-cal, html[data-theme="dark"] .hm-cal-table, html[data-theme="dark"] .hm-next { background: var(--surface); border-color: var(--rule); }
    html[data-theme="dark"] .hm-search input, html[data-theme="dark"] .hm-card b, html[data-theme="dark"] .hm-learn-body b, html[data-theme="dark"] .hm-next b, html[data-theme="dark"] .hm-cal-ev { color: var(--ink); }
    html[data-theme="dark"] .hm-quick-grid a { border-color: var(--rule); }
    html[data-theme="dark"] .hm-quick-grid a:hover, html[data-theme="dark"] a.hm-cal-row:hover, html[data-theme="dark"] .hm-cal-headrow { background: var(--navy-2); }
    html[data-theme="dark"] .hm-card-faint { color: var(--rule); }
    html[data-theme="dark"] .hm-tabs { background: var(--surface); }
    html[data-theme="dark"] .hm-tabs button.on { background: var(--navy-2); color: var(--mint); }
    html[data-theme="dark"] .hm-more, html[data-theme="dark"] .hm-read { color: var(--mint); }


@media (max-width: 1024px) {
    .hm-hero-inner, .hm-tools-inner, .hm-cal-inner { grid-template-columns: minmax(0, 1fr); }
    .hm-focus { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hm-lead-card { grid-column: 1 / -1; grid-row: auto; }
    .hm-next { left: 1rem; }
}
@media (max-width: 760px) {
    .hm-hero-inner { padding: 2.25rem 0 3.5rem; gap: 2rem; }
    .hm-title { font-size: 2.3rem; }
    .hm-lead { font-size: .95rem; line-height: 1.85; }
    .hm-search input { font-size: 16px; }
    .hm-search button { padding: .75rem 1rem; }
    .hm-quote { padding: 1.25rem; border-radius: 22px; }
    .hq-price { font-size: 2rem; }
    .hq-chart { height: 140px; }
    .hm-next { left: .5rem; right: .5rem; max-width: none; }
    .hm-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-block: 0; }
    .hm-quick-grid a { padding: 1rem .5rem; border-left: 0; border-top: 1px solid #F1F5F9; }
    .hm-quick-grid a:nth-child(-n+2) { border-top: 0; }
    .hm-quick-grid a:nth-child(2n) { border-left: 1px solid #F1F5F9; padding-left: 1rem; }
    .hm-section { padding-top: 3rem; }
    .hm-focus { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
    .hm-lead-card { min-height: 320px; padding: 1.4rem; }
    .hm-card { min-height: 0; }
    .hm-tools { padding: 3.25rem 0; }
    .hm-calc { padding: 1.25rem; border-radius: 22px; }
    .hm-calc-grid { grid-template-columns: minmax(0, 1fr); }
    .hm-input input, .hm-calc-grid select { font-size: 16px; }
    .hm-calc-out { flex-wrap: wrap; }
    .hm-calc-out .button { flex-basis: 100%; }
    .hm-learn { grid-template-columns: minmax(0, 1fr); }
    .hm-section-head { align-items: flex-start; }
    .hm-tabs { max-width: 100%; }
    .hm-cal { padding: 3rem 0; }
    .hm-cal-row { grid-template-columns: 4.3rem 3.3rem minmax(0, 1fr) 3.4rem; padding: .9rem; }
}
@media (max-width: 760px) {
    .hm-quote-glow { right: 0; }
    /* บทเรียนบนมือถือ: ปัดซ้ายขวาแบบแอป ไม่ต้องเลื่อนยาว */
    .hm-learn {
        grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory;
        scrollbar-width: none; margin-inline: calc(-1 * var(--gap)); padding-inline: var(--gap); scroll-padding-inline: var(--gap);
    }
    .hm-learn::-webkit-scrollbar { display: none; }
    .hm-learn-card { scroll-snap-align: start; }
    .hm-learn-art { height: 8rem; }
}

/* เมนูมือถือ: backdrop-filter ของหัวเว็บทำให้แผง position:fixed ถูกตัดเหลือแค่ความสูงหัวเว็บ — ปิดตอนเปิดเมนู และยกหัวเว็บขึ้นเหนือแถบเมนูล่าง */
body:has(.mobile-menu[open]) .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; z-index: 100; }
body:has(.mobile-menu[open]) .bottom-nav { display: none; }

/* ข่าว: สมาชิกเห็นก่อน */
.gate-strip {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin: 0 0 1rem; padding: .9rem 1.1rem; border-radius: var(--radius); background: var(--brand-wash); border: 1px solid #A7F3D0;
}
.gate-strip p { margin: 0; display: grid; gap: .1rem; }
.gate-strip b { color: var(--brand-dark); }
.gate-strip span { font-size: .85rem; color: var(--ink-soft); }
.gate-strip .button { border-radius: 12px; }
.flash-effect.is-locked { background: #FFF7ED; border: 1px dashed #FDBA74; }
.flash-effect.is-locked .flash-effect-label { color: #C2410C; }
.gate-actions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-top: .55rem !important; }
.gate-actions .button { min-height: 2.3rem; padding: .35rem 1rem; font-size: .85rem; border-radius: 10px; }
.flash-mine { margin: .1rem 0 .35rem; display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: #FEF3C7; color: #92400E; font-size: .78rem; font-weight: 700; }
.gate-paywall { border-color: #34D399; background: var(--brand-wash); }
.gate-paywall h2 { margin: 0; font-size: 1.15rem; }
.gate-paywall p { margin: 0; }
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .gate-strip { border-color: var(--rule); }
    html[data-theme="auto"] .flash-effect.is-locked { background: var(--gold-wash); border-color: #7C3A1E; }
    html[data-theme="auto"] .flash-mine { background: #3A2E12; color: #FCD34D; }
}
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .gate-strip { border-color: var(--rule); }
    html[data-theme="dark"] .flash-effect.is-locked { background: var(--gold-wash); border-color: #7C3A1E; }
    html[data-theme="dark"] .flash-mine { background: #3A2E12; color: #FCD34D; }

@media (max-width: 760px) {
    .gate-strip .button { width: 100%; justify-content: center; }
}

/* ---------- ผลงานเทรดจริง ---------- */
.sc-verified { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .6rem 0 0; padding: .4rem .8rem; border-radius: 999px; background: var(--brand-wash); color: var(--brand-dark); font-size: .82rem; font-weight: 600; }
.sc-verified svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sc-kpis { display: grid; grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 1.4rem 0 1rem; }
.sc-kpi { display: grid; gap: .25rem; padding: 1.1rem 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); min-width: 0; }
.sc-kpi > span { font-size: .78rem; color: var(--ink-soft); }
.sc-kpi b { font-family: var(--font-head); font-size: 1.5rem; line-height: 1.2; color: var(--ink); }
.sc-kpi small { font-size: .74rem; color: var(--ink-soft); }
.sc-kpi-main b { font-size: 2.2rem; }
.sc-kpi b.pos { color: var(--up); }
.sc-kpi b.neg { color: var(--down); }
.sc-chart { margin-bottom: 1rem; }
.sc-box-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; }
.sc-cta { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem 1.5rem; margin: 0 0 1rem; padding: 1.3rem 1.4rem; border-radius: var(--radius); background: var(--navy); color: var(--navy-ink); }
.sc-cta h2 { margin: 0 0 .3rem; font-size: 1.15rem; color: #fff; }
.sc-cta p { margin: 0; font-size: .88rem; color: var(--navy-soft); }
.sc-cta-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.sc-cta-btns .button:not(.button-hot) { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
.sc-cta .sc-cta-risk { grid-column: 1 / -1; font-size: .74rem; }
.sc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; align-items: start; }
.sc-table td, .sc-table th { white-space: nowrap; }
.sc-table td.pos { color: var(--up); font-weight: 700; }
.sc-table td.neg { color: var(--down); font-weight: 700; }
.sc-stats { margin: 0; display: grid; }
.sc-stats div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); font-size: .9rem; }
.sc-stats div:last-child { border-bottom: 0; }
.sc-stats dt { color: var(--ink-soft); }
.sc-stats dd { margin: 0; font-weight: 700; text-align: right; }
.sc-stats dd.pos { color: var(--up); }
.sc-stats dd.neg { color: var(--down); }
.sc-disclaimer { margin-top: 1rem; }
@media (max-width: 900px) {
    .sc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sc-kpi-main { grid-column: 1 / -1; }
    .sc-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .sc-cta { grid-template-columns: minmax(0, 1fr); }
    .sc-cta-btns .button { flex: 1 1 100%; justify-content: center; }
    .sc-kpi b { font-size: 1.25rem; }
    .sc-kpi-main b { font-size: 1.9rem; }
}

/* ---------- ผลงานเทรดจริง: ป้ายบัญชี + คำอธิบาย + กล่องหน้าแรก ---------- */
.sc-badges { margin: .5rem 0 0; }
.sc-acc { display: inline-block; padding: .3rem .75rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.sc-acc.is-demo { background: #FFF7ED; color: #C2410C; }
.sc-acc.is-real { background: var(--brand-wash); color: var(--brand-dark); }
.sc-explain { margin: 0 0 1rem; padding: .85rem 1rem; border-radius: var(--radius); background: var(--surface-2, var(--surface)); border: 1px dashed var(--rule); font-size: .88rem; line-height: 1.7; color: var(--ink-soft); }
.hm-results { padding: 3rem 0; }
.hm-results-inner { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; }
.hm-results-copy h2 { margin: .2rem 0 .6rem; font-size: 1.6rem; }
.hm-results-copy p { margin: 0 0 .9rem; color: var(--ink-soft); line-height: 1.7; }
.hm-results-card { display: grid; gap: .8rem; padding: 1.3rem 1.4rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.hm-results-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.hm-results-nums div { display: grid; gap: .15rem; min-width: 0; }
.hm-results-nums small { font-size: .74rem; color: var(--ink-soft); }
.hm-results-nums b { font-family: var(--font-head); font-size: 1.45rem; color: var(--ink); }
.hm-results-nums b.pos { color: var(--up); }
.hm-results-nums b.neg { color: var(--down); }
.hm-results-spark { width: 100%; height: 70px; }
.hm-results-spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.hm-results-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .sc-acc.is-demo { background: rgba(251, 146, 60, .15); color: #FDBA74; }
}
html[data-theme="dark"] .sc-acc.is-demo { background: rgba(251, 146, 60, .15); color: #FDBA74; }
@media (max-width: 760px) {
    .hm-results-inner { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
    .hm-results-nums b { font-size: 1.15rem; }
    .hm-results-btns .button { flex: 1 1 100%; justify-content: center; }
}

/* ---------- ห้องเทรด AI (pixel) ---------- */
.dk-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .6rem 0 0; }
.dk-status { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; background: #F1F5F9; color: #475569; font-size: .8rem; font-weight: 700; }
.dk-status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #94A3B8; }
.dk.is-online .dk-status { background: var(--brand-wash); color: var(--brand-dark); }
.dk.is-online .dk-status::before { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .25); }
.dk.is-demo .dk-status { background: #FFF7ED; color: #C2410C; }
.dk.is-demo .dk-status::before { background: #F97316; }
.dk-seen { font-size: .78rem; color: var(--ink-soft); }
.dk-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; margin: 1.2rem 0 1rem; align-items: start; }
.dk-stage { position: relative; border-radius: 14px; overflow: hidden; background: #0B1F1A; border: 3px solid #0B1F1A; box-shadow: 0 6px 0 #071512; }
.dk-stage canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; }
.dk-bubbles { position: absolute; inset: 0; pointer-events: none; }
.dk-bubble { position: absolute; max-width: min(260px, 70%); padding: .45rem .6rem; border: 2px solid #0B1F1A; border-radius: 6px; background: #FFFDF5; color: #10251F; box-shadow: 3px 3px 0 rgba(11, 31, 26, .55); font-size: .78rem; line-height: 1.45; animation: dk-pop .18s ease-out; }
.dk-bubble b { display: block; font-size: .68rem; color: #64748B; margin-bottom: .1rem; }
.dk-bubble.is-no { background: #FEF2F2; border-color: #B91C1C; }
.dk-bubble.is-yes { background: #F0FDF4; border-color: #15803D; }
.dk-bubble.is-idea { background: #FFFBEB; border-color: #B45309; }
.dk-bubble.is-alert { background: #FFF7ED; border-color: #C2410C; }
@keyframes dk-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.dk-replay { position: absolute; right: .5rem; bottom: .5rem; padding: .35rem .7rem; border: 2px solid #0B1F1A; border-radius: 6px; background: #FDE68A; color: #0B1F1A; font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; box-shadow: 2px 2px 0 #0B1F1A; }
.dk-replay:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.dk-side { display: grid; gap: 1rem; }
.dk-card { padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); min-width: 0; }
.dk-card h2 { margin: 0 0 .7rem; font-size: .95rem; }
.dk-kv { margin: 0; display: grid; }
.dk-kv div { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--rule); font-size: .85rem; }
.dk-kv div:last-child { border-bottom: 0; }
.dk-kv dt { color: var(--ink-soft); }
.dk-kv dd { margin: 0; font-weight: 700; text-align: right; }
.dk-snote { margin: .6rem 0 0; font-size: .82rem; line-height: 1.65; color: var(--ink-soft); }
.dk-snote:empty { display: none; }
.dk-roster { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.dk-roster li { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; padding: .6rem .7rem; border-radius: 10px; border: 1px solid var(--rule); }
.dk-roster li.is-pick { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.dk-roster b { font-size: .86rem; }
.dk-roster small { grid-column: 1 / -1; font-size: .74rem; color: var(--ink-soft); line-height: 1.5; }
.dk-tag { align-self: start; padding: .12rem .5rem; border-radius: 999px; background: #FEF9C3; color: #854D0E; font-size: .66rem; font-weight: 700; white-space: nowrap; }
.dk-tag.is-real { background: var(--brand-wash); color: var(--brand-dark); }
.dk-lower { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 1rem; margin-bottom: 1rem; }
.dk-log { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; max-height: 340px; overflow-y: auto; }
.dk-log li { display: grid; grid-template-columns: 7.5rem 1fr; gap: .6rem; font-size: .84rem; line-height: 1.55; animation: dk-pop .2s ease-out; }
.dk-log li b { color: var(--ink-soft); font-size: .76rem; }
.dk-log li.is-no span { color: var(--down); }
.dk-log li.is-yes span { color: var(--up); }
.dk-history { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; max-height: 340px; overflow-y: auto; }
.dk-history button { width: 100%; display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--rule); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: .8rem; text-align: left; cursor: pointer; }
.dk-history button:hover { border-color: var(--brand); }
.dk-history time { color: var(--ink-soft); }
.dk-history .is-open_buy span { color: var(--up); font-weight: 700; }
.dk-history .is-open_sell span { color: var(--down); font-weight: 700; }
.dk-cast { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.dk-cast-item { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--rule); font-size: .74rem; color: var(--ink-soft); }
.dk-cast-item::before { content: ""; width: .6rem; height: .6rem; border-radius: 2px; }
.dk-c-hunter::before { background: #B45309; } .dk-c-risk::before { background: #1D4ED8; } .dk-c-news::before { background: #DC2626; }
.dk-c-ai::before { background: #7C3AED; } .dk-c-guard::before { background: #334155; } .dk-c-sec::before { background: #059669; }
.dk-c-range::before { background: #CA8A04; } .dk-c-pull::before { background: #EAB308; }
.dk-cta { margin: 0 0 .8rem; }
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .dk-status { background: rgba(148, 163, 184, .15); color: #CBD5E1; }
    html[data-theme="auto"] .dk.is-demo .dk-status { background: rgba(251, 146, 60, .15); color: #FDBA74; }
    html[data-theme="auto"] .dk-tag { background: rgba(250, 204, 21, .15); color: #FDE68A; }
}
html[data-theme="dark"] .dk-status { background: rgba(148, 163, 184, .15); color: #CBD5E1; }
html[data-theme="dark"] .dk.is-demo .dk-status { background: rgba(251, 146, 60, .15); color: #FDBA74; }
html[data-theme="dark"] .dk-tag { background: rgba(250, 204, 21, .15); color: #FDE68A; }
@media (max-width: 960px) {
    .dk-main, .dk-lower { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .dk-bubble { font-size: .68rem; padding: .3rem .45rem; max-width: 62%; }
    .dk-bubble b { font-size: .6rem; }
    .dk-log li { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
    .dk-history button { grid-template-columns: minmax(0, 1fr); }
    .dk-cta .button { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .dk-bubble, .dk-log li { animation: none; }
}
@media (max-width: 760px) {
    .dk-replay { position: static; display: block; width: 100%; border-radius: 0; border-width: 2px 0 0; box-shadow: none; padding: .55rem; }
}
.dk-pstats { grid-column: 1 / -1; font-style: normal; font-size: .72rem; color: var(--ink); background: var(--surface-2, transparent); border-top: 1px dashed var(--rule); padding-top: .35rem; margin-top: .15rem; }
.dk-pstats:empty { display: none; }
.dk-roster li.is-promo { border-color: #CA8A04; }

/* ---------- ห้องเทรด AI: ค่าสถานะแบบเกม ---------- */
.dk-hud { position: absolute; left: .5rem; top: .5rem; width: min(220px, 42%); padding: .45rem .55rem; border: 2px solid #0B1F1A; border-radius: 6px; background: rgba(255, 253, 245, .93); color: #10251F; box-shadow: 3px 3px 0 rgba(11, 31, 26, .55); font-size: .7rem; line-height: 1.35; display: grid; gap: .25rem; }
.dk-hud-top { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.dk-lv { font-family: var(--font-mono, monospace); font-size: .85rem; letter-spacing: .02em; color: #92400E; }
.dk-sample { padding: 0 .35rem; border-radius: 3px; background: #FFEDD5; color: #C2410C; font-size: .6rem; font-weight: 700; }
.dk-bar { display: grid; grid-template-columns: 3.2rem 1fr auto; align-items: center; gap: .35rem; }
.dk-bar span { font-weight: 700; font-size: .62rem; }
.dk-bar i { position: relative; height: 8px; border: 1.5px solid #0B1F1A; background: #1F2937; border-radius: 2px; overflow: hidden; }
.dk-bar em { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#4ADE80, #16A34A); transition: width .6s; }
.dk-bar em.is-mid { background: linear-gradient(#FDE047, #CA8A04); }
.dk-bar em.is-low { background: linear-gradient(#F87171, #B91C1C); }
.dk-exp i { height: 5px; }
.dk-exp em { background: linear-gradient(#93C5FD, #2563EB); }
.dk-bar b { font-family: var(--font-mono, monospace); font-size: .62rem; }
.dk-hud-nums { display: flex; justify-content: space-between; gap: .4rem; font-size: .64rem; }
.dk-hud-nums b, .dk-streak { font-family: var(--font-mono, monospace); }
.dk-hud .up { color: #15803D; }
.dk-hud .down { color: #B91C1C; }
.dk-streak { font-size: .64rem; font-weight: 700; }
.dk-streak:empty { display: none; }
.dk-floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dk-float { position: absolute; transform: translateX(-50%); font-family: var(--font-mono, monospace); font-size: 1.35rem; font-weight: 800; -webkit-text-stroke: 1.5px #0B1F1A; paint-order: stroke fill; animation: dk-float 2.6s ease-out both; }
.dk-float.is-win { color: #4ADE80; }
.dk-float.is-loss { color: #F87171; }
@keyframes dk-float { 0% { opacity: 0; translate: 0 10px; scale: .6; } 15% { opacity: 1; scale: 1.15; } 30% { scale: 1; } 100% { opacity: 0; translate: 0 -60px; } }
.dk-cast-item { flex-direction: column; align-items: flex-start; gap: .05rem; border-radius: 10px; padding: .35rem .65rem .35rem 1.3rem; position: relative; }
.dk-cast-item::before { position: absolute; left: .45rem; top: .55rem; }
.dk-cast-item b { font-size: .74rem; color: var(--ink); }
.dk-cast-item small { font-family: var(--font-mono, monospace); font-size: .68rem; color: var(--ink-soft); }
.dk-cast-item small:empty { display: none; }
@media (max-width: 760px) {
    .dk-hud { width: 48%; left: .3rem; top: .3rem; padding: .3rem .4rem; gap: .15rem; font-size: .58rem; }
    .dk-hud-nums, .dk-exp, .dk-streak { display: none; }
    .dk-bar { grid-template-columns: 2.4rem 1fr auto; }
    .dk-lv { font-size: .7rem; }
    .dk-float { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
    .dk-float { animation-duration: .01s; animation-delay: 0s !important; opacity: 1; }
}

/* ---------- ห้องเทรด AI: รอบตลาด + บอส + เกมทาย ---------- */
.dk-session { position: absolute; right: .5rem; top: .5rem; padding: .25rem .55rem; border: 2px solid #0B1F1A; border-radius: 6px; background: #FFFDF5; color: #10251F; font-size: .68rem; font-weight: 700; box-shadow: 2px 2px 0 rgba(11, 31, 26, .55); }
.dk-session.is-overlap { background: #DCFCE7; }
.dk-session.is-ny { background: #FFEDD5; }
.dk-session.is-asia, .dk-session.is-quiet { background: #E0E7FF; }
.dk-session.is-closed { background: #1E293B; color: #E2E8F0; border-color: #0F172A; }
.dk-boss { position: absolute; left: .5rem; bottom: .5rem; max-width: 62%; padding: .3rem .6rem; border: 2px solid #4C0519; border-radius: 6px; background: #FFF1F2; color: #881337; font-size: .7rem; font-weight: 700; box-shadow: 2px 2px 0 rgba(76, 5, 25, .5); font-variant-numeric: tabular-nums; }
.dk-boss.is-live { background: #9F1239; color: #fff; animation: dk-pulse 1s ease-in-out infinite; }
.dk-boss.is-done { background: #F1F5F9; color: #334155; border-color: #475569; }
@keyframes dk-pulse { 50% { box-shadow: 0 0 0 4px rgba(159, 18, 57, .35); } }
.dk-predict-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.dk-predict-head h2 { margin: 0; }
.dk-predict-q { margin: 0 0 .6rem; font-size: .84rem; line-height: 1.55; }
.dk-predict-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.dk-pbtn { display: flex; align-items: center; justify-content: center; min-height: 2.8rem; border: 2px solid #0B1F1A; border-radius: 8px; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; box-shadow: 3px 3px 0 #0B1F1A; text-decoration: none; transition: transform .08s; }
.dk-pbtn.is-up { background: #DCFCE7; color: #14532D; }
.dk-pbtn.is-down { background: #FEE2E2; color: #7F1D1D; }
.dk-pbtn.is-on.is-up { background: #16A34A; color: #fff; }
.dk-pbtn.is-on.is-down { background: #DC2626; color: #fff; }
.dk-pbtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #0B1F1A; }
.dk-pbtn:disabled { opacity: .6; cursor: wait; }
.dk-predict-note { margin: .5rem 0 0; font-size: .74rem; color: var(--ink-soft); line-height: 1.5; }
.dk-predict-me { margin: .35rem 0 0; font-size: .8rem; font-weight: 700; }
.dk-predict h3 { margin: .9rem 0 .4rem; font-size: .82rem; }
.dk-board { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.dk-board li { display: grid; grid-template-columns: 1.6rem 1fr auto 2.6rem; gap: .4rem; align-items: center; padding: .35rem .4rem; border-radius: 6px; font-size: .8rem; }
.dk-board li:nth-child(odd) { background: var(--surface-2, rgba(148, 163, 184, .08)); }
.dk-board li.is-ai { box-shadow: inset 3px 0 0 #7C3AED; }
.dk-board li.is-me { box-shadow: inset 3px 0 0 var(--brand); font-weight: 700; }
.dk-rank { font-family: var(--font-mono, monospace); color: var(--ink-soft); text-align: center; }
.dk-board li:nth-child(1) .dk-rank { color: #CA8A04; font-weight: 800; }
.dk-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-pts { font-family: var(--font-mono, monospace); font-weight: 800; }
.dk-board small { color: var(--ink-soft); text-align: right; font-size: .7rem; }
@media (max-width: 760px) {
    .dk-session { font-size: .56rem; padding: .15rem .35rem; right: .3rem; top: .3rem; }
    .dk-boss { font-size: .58rem; left: .3rem; bottom: .3rem; padding: .2rem .4rem; }
}
@media (prefers-reduced-motion: reduce) { .dk-boss.is-live { animation: none; } }
@media (max-width: 760px) {
    .dk-boss { left: auto; right: .3rem; bottom: auto; top: 1.9rem; max-width: 52%; }
}
/* ห้องเทรด AI: ให้บันทึกการประชุมอยู่ใต้ฉาก (คอลัมน์ซ้าย) ไม่เหลือช่องว่างเมื่อคอลัมน์ขวายาวกว่า */
.dk-main { grid-template-areas: "stage side" "lower side"; }
.dk-main > .dk-stage { grid-area: stage; }
.dk-main > .dk-side { grid-area: side; }
.dk-main > .dk-lower { grid-area: lower; margin-bottom: 0; }
@media (max-width: 960px) {
    .dk-main { grid-template-areas: "stage" "side" "lower"; }
}
.dk-main { grid-template-rows: auto 1fr; }
.dk-main > .dk-lower { align-self: start; }
@media (max-width: 960px) { .dk-main { grid-template-rows: none; } }

/* ---------- ห้องเทรด AI: ถามทีม + ถ้วยรางวัล ---------- */
.dk-main { grid-template-areas: "stage side" "ask side" "lower side"; grid-template-rows: auto auto 1fr; }
.dk-main > .dk-askwrap { grid-area: ask; }
@media (max-width: 960px) { .dk-main { grid-template-areas: "stage" "side" "ask" "lower"; grid-template-rows: none; } }
.dk-ask-form { display: flex; gap: .5rem; }
.dk-ask-form input { flex: 1; min-width: 0; padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; }
.dk-ask-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.dk-ask-chips button { padding: .3rem .65rem; border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: var(--ink-soft); font: inherit; font-size: .74rem; cursor: pointer; }
.dk-ask-chips button:hover { border-color: var(--brand); color: var(--ink); }
.dk-ask-error { margin: .55rem 0 0; color: var(--down); font-size: .8rem; }
.dk-ask-answer { margin-top: .7rem; padding: .65rem .8rem; border: 2px solid #0B1F1A; border-radius: 8px; background: #FFFDF5; color: #10251F; box-shadow: 3px 3px 0 rgba(11, 31, 26, .4); }
.dk-ask-answer b { display: block; font-size: .72rem; color: #64748B; }
.dk-ask-answer p { margin: .15rem 0 0; font-size: .88rem; line-height: 1.6; }
.dk-trophy-card { margin-bottom: 1rem; }
.dk-trophies { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .5rem; }
.dk-trophies li { display: grid; justify-items: center; gap: .15rem; padding: .6rem .4rem; border: 1px dashed var(--rule); border-radius: 10px; text-align: center; filter: grayscale(1); opacity: .55; }
.dk-trophies li.is-on { filter: none; opacity: 1; border-style: solid; border-color: #CA8A04; background: rgba(250, 204, 21, .08); }
.dk-trophies li span { font-size: 1.6rem; line-height: 1; }
.dk-trophies li small { font-size: .72rem; font-weight: 700; color: var(--ink); }
.dk-trophies li em { font-style: normal; font-size: .64rem; color: var(--ink-soft); }
.dk-trophies li em:empty { display: none; }
.dk-trophies.is-small { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .3rem; }
.dk-trophies.is-small li { padding: .35rem .15rem; }
.dk-trophies.is-small li span { font-size: 1.15rem; }
.dk-trophies.is-small li small { font-size: .56rem; line-height: 1.25; }
.dk-toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: .55rem .9rem; border: 3px solid #0B1F1A; border-radius: 8px; background: #FDE68A; color: #0B1F1A; font-weight: 800; font-size: .9rem; box-shadow: 4px 4px 0 #0B1F1A; animation: dk-pop .25s ease-out; z-index: 2; white-space: nowrap; }
@media (max-width: 760px) {
    .dk-toast { font-size: .7rem; top: 30%; }
    .dk-ask-form { flex-direction: column; }
    .dk-ask-form input { font-size: 16px; }
}

/* ===== พจนานุกรมศัพท์เทรด ===== */
.gl-hero { background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2rem); margin-bottom: 1rem; }
.gl-hero h1 { color: #fff; margin: 0 0 .3rem; font-size: clamp(1.6rem, 3.8vw, 2.3rem); }
.gl-hero p { margin: 0 0 1rem; color: var(--navy-soft); max-width: 40rem; }
.gl-search { display: flex; gap: .5rem; max-width: 32rem; }
.gl-search input { flex: 1; min-width: 0; font-size: 16px; padding: .6rem .8rem; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.gl-count { margin: .2rem 0 .6rem; }
.gl-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: .6rem; }
.gl-list li { background: var(--surface); border-radius: var(--radius); padding: .85rem 1rem; border: 1px solid var(--rule); }
.gl-list a { color: var(--brand); text-decoration: none; }
.gl-list a:hover b { text-decoration: underline; }
.gl-list p { margin: .25rem 0 0; color: var(--ink-soft); font-size: .92rem; line-height: 1.5; }
.gl-foot { margin: 1.2rem 0; }
.gl-term-page { background: var(--surface); border-radius: var(--radius); padding: clamp(1.1rem, 4vw, 2rem); max-width: 46rem; }
.gl-crumb { font-size: .9rem; margin-bottom: .4rem; }
.gl-term-page h1 { margin: 0 0 .4rem; }
.gl-lead { font-size: 1.1rem; color: var(--ink); background: var(--brand-wash); border-left: 4px solid var(--brand); padding: .7rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; }
.gl-related { max-width: 46rem; margin: 1rem 0; }
.gl-related h2 { font-size: 1.1rem; }
.gl-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.gl-chips a { display: inline-block; padding: .35rem .75rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); color: var(--brand); text-decoration: none; font-size: .92rem; }
/* คำศัพท์ที่ลิงก์อัตโนมัติในบทความ: เส้นประ ไม่แย่งสายตาจากลิงก์ปกติ */
.prose a.gl-term { color: inherit; text-decoration: underline dotted var(--brand); text-underline-offset: .2em; text-decoration-thickness: 2px; cursor: help; }
.prose a.gl-term:hover { color: var(--brand); }

/* ===== ผู้ช่วย AI (ปุ่มแชตมุมขวาล่าง) ===== */
.as-root { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; display: grid; justify-items: end; gap: .6rem; }
.as-fab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 1.5rem; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); display: grid; place-items: center; }
.as-fab:hover { background: var(--brand-dark); }
.as-fab:focus-visible, .as-close:focus-visible, .as-send:focus-visible { outline: 3px solid var(--hot, #E86F3E); outline-offset: 2px; }
.as-root.is-open .as-fab { display: none; }
.as-fab { transition: transform .2s ease, opacity .2s ease; }
.as-root.is-tucked .as-fab { transform: translateX(70%); opacity: .55; }
@media (prefers-reduced-motion: reduce) { .as-fab { transition: none; } }
.as-panel { width: min(360px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25); overflow: hidden; }
.as-panel[hidden] { display: none; }
.as-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; background: var(--brand); color: #fff; }
.as-close { background: transparent; border: 0; color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.as-log { flex: 1; overflow-y: auto; padding: .8rem; display: grid; gap: .5rem; align-content: start; }
.as-msg { max-width: 88%; padding: .55rem .75rem; border-radius: 14px; font-size: .95rem; line-height: 1.5; }
.as-msg p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.as-bot { background: var(--brand-wash); justify-self: start; border-bottom-left-radius: 4px; }
.as-me { background: var(--brand); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.as-msg.is-wait { opacity: .7; }
.as-links { margin: .4rem 0 0; padding-left: 1rem; }
.as-links a { color: var(--brand); font-weight: 600; }
.as-form { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--rule); }
.as-form input { flex: 1; min-width: 0; font-size: 16px; padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); }
.as-send { border: 0; border-radius: 10px; padding: 0 .9rem; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; }
.as-send:disabled { opacity: .6; cursor: default; }
.as-note { margin: 0; padding: 0 .8rem .6rem; font-size: .75rem; color: var(--ink-soft); }
@media (max-width: 760px) {
    /* เหนือแถบเมนูล่างบนมือถือ */
    .as-root { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; }
    .as-fab { width: 46px; height: 46px; font-size: 1.2rem; }
}
@media print { .as-root { display: none; } }

/* ===== หุ้น ===== */
.stk-hero { background: var(--navy); color: var(--navy-ink); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2rem); margin-bottom: 1rem; }
.stk-hero h1 { color: #fff; margin: 0 0 .3rem; font-size: clamp(1.6rem, 3.8vw, 2.3rem); }
.stk-hero p { margin: 0 0 1rem; color: var(--navy-soft); max-width: 40rem; }
.stk-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.stk-tabs a { padding: .4rem .85rem; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; font-weight: 600; font-size: .92rem; }
.stk-tabs a.is-on { background: #fff; color: var(--navy); }
.stk-tabs.is-small a { background: var(--brand-wash); color: var(--brand); padding: .25rem .7rem; font-size: .85rem; }
.stk-tabs.is-small a.is-on { background: var(--brand); color: #fff; }
.is-up { color: var(--up); }
.is-down { color: var(--down); }
.stk-movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stk-movers > div { background: var(--surface); border-radius: var(--radius); padding: .8rem 1rem; border: 1px solid var(--rule); }
.stk-movers h2 { font-size: 1rem; margin: 0 0 .4rem; }
.stk-mini { display: flex; justify-content: space-between; padding: .3rem 0; text-decoration: none; color: var(--ink); border-top: 1px solid var(--rule); }
.stk-mini:first-of-type { border-top: 0; }
.stk-table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--rule); }
.stk-table { width: 100%; border-collapse: collapse; }
.stk-table th, .stk-table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--rule); font-size: .95rem; }
.stk-table th { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.stk-table td a { display: grid; text-decoration: none; color: var(--ink); }
.stk-table td a small { color: var(--ink-soft); font-size: .8rem; }
.stk-table td:nth-child(2), .stk-table td:nth-child(3), .stk-table th:nth-child(2), .stk-table th:nth-child(3) { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.stk-recaps { margin: 1.2rem 0; }
.stk-recaps h2 { font-size: 1.1rem; }
.stk-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .5rem 1rem; margin: .4rem 0 1rem; }
.stk-head h1 { margin: 0; }
.stk-head h1 small { font-size: .55em; color: var(--ink-soft); font-weight: 500; }
.stk-head p { margin: .2rem 0 0; }
.stk-price { display: grid; justify-items: end; font-family: var(--font-mono); }
.stk-price b { font-size: 1.8rem; }
.stk-chart-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--rule); padding: .8rem 1rem; margin-bottom: 1rem; }
.stk-chart { width: 100%; height: 240px; display: block; margin-top: .6rem; }
.stk-chart polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.stk-line { stroke-width: 2.2; }
.stk-line.is-up { stroke: var(--up); }
.stk-line.is-down { stroke: var(--down); }
.stk-sma { stroke: #F59E0B; stroke-width: 1.5; stroke-dasharray: 5 4; }
.stk-chart-axis { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--ink-soft); }
.stk-legend { display: inline-flex; align-items: center; gap: .3rem; }
.stk-legend-sma { width: 1.2rem; border-top: 2px dashed #F59E0B; display: inline-block; }
.stk-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stk-stats > div { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .8rem; display: grid; gap: .15rem; }
.stk-stats small { color: var(--ink-soft); font-size: .8rem; }
.stk-stats b { font-family: var(--font-mono); font-size: .98rem; }
.stk-ai { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--rule); padding: 1rem 1.2rem; margin-bottom: .8rem; }
.stk-ai h2 { margin-top: 0; font-size: 1.15rem; }
@media (max-width: 760px) {
    .stk-hide-m { display: none; }
    .stk-chart { height: 200px; }
}

/* ติดตามหุ้น + แจ้งเตือนราคา */
.stk-watch, .stk-mylist { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.stk-watch-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin: 0; }
.stk-alert-form { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .7rem; }
.stk-alert-form label { font-size: .9rem; color: var(--ink-soft); }
.stk-alert-form select, .stk-alert-form input { font-size: 16px; padding: .45rem .6rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); }
.stk-alert-form input { width: 8rem; }
.stk-watch-err { color: var(--down); margin: .4rem 0 0; font-size: .9rem; }
.stk-alerts { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.stk-alerts li { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .6rem; border-radius: 999px; background: var(--brand-wash); font-family: var(--font-mono); font-size: .88rem; }
.stk-alerts li.is-done { opacity: .6; }
.stk-mylist-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; }
.stk-mylist h2 { font-size: 1.05rem; margin: 0; }
.stk-digest { font-size: .88rem; display: inline-flex; align-items: center; gap: .3rem; }
.stk-mylist ul { list-style: none; margin: .5rem 0 0; padding: 0; }
.stk-mylist li { display: grid; grid-template-columns: minmax(0, 1fr) auto 4.5rem 2.5rem auto; gap: .5rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--rule); font-size: .95rem; }
.stk-mylist li:first-child { border-top: 0; }
.stk-mylist li a { text-decoration: none; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-mylist li > span { font-family: var(--font-mono); text-align: right; }

/* ===== ห้องเทรด AI: AI Trader ปะทะ EA ===== */
.ait-board { margin: 1rem 0; }
.ait-board h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.ait-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: stretch; margin: .8rem 0; }
.ait-side { display: grid; gap: .2rem; align-content: start; padding: .7rem .8rem; border-radius: var(--radius); background: var(--brand-wash); font-size: .92rem; }
.ait-side b { font-size: 1rem; }
.ait-vs-mid { align-self: center; font-family: var(--font-head); font-weight: 800; color: var(--hot, #E86F3E); }
.ait-open { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; padding: .6rem .8rem; border: 2px dashed var(--brand); border-radius: var(--radius); font-size: .92rem; }
.ait-chat { display: grid; gap: .5rem; }
.ait-msg { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; }
.ait-msg .dk-cast-item { white-space: nowrap; }
.ait-msg p { margin: 0; padding: .55rem .75rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); font-size: .93rem; line-height: 1.55; }
.ait-scores { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .3rem; }
.ait-scores li { display: grid; grid-template-columns: minmax(7rem, 9rem) 1fr 2.2rem; gap: .5rem; align-items: center; font-size: .85rem; }
.ait-scores i { height: .5rem; border-radius: 999px; background: var(--rule); overflow: hidden; }
.ait-scores em { display: block; height: 100%; background: var(--ink-soft); border-radius: 999px; }
.ait-scores em.is-buy { background: var(--up); }
.ait-scores em.is-sell { background: var(--down); }
.ait-scores b { text-align: right; font-family: var(--font-mono); }
.ait-trades { list-style: none; margin: 0; padding: 0; }
.ait-trades li { display: grid; grid-template-columns: auto auto 1fr auto; gap: .6rem; padding: .35rem 0; border-top: 1px solid var(--rule); font-size: .9rem; }
.ait-trades li:first-child { border-top: 0; }
@media (max-width: 760px) {
    .ait-vs { grid-template-columns: 1fr; }
    .ait-vs-mid { justify-self: center; }
    .ait-msg { grid-template-columns: 1fr; gap: .25rem; }
}

/* ───── การ์ดข่าวสด (LiveEventCard + js/live-event.js) ───── */
.hm-live { margin-top: var(--gap); }
.le-card { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--hot); border-radius: var(--radius-sm);
  padding: .9rem 1.1rem; margin: 1rem 0; box-shadow: var(--shadow); }
.le-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.le-head b { font-family: var(--font-head); font-size: 1.02rem; min-width: 0; overflow-wrap: anywhere; }
.le-badge { font-size: .78rem; font-weight: 700; color: var(--gold-ink); background: var(--gold-wash); border-radius: 999px; padding: .15rem .6rem; }
.le-badge.is-out { color: var(--brand-dark); background: var(--brand-wash); }
.le-count { font-family: var(--font-head); font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 700; color: var(--hot);
  font-variant-numeric: tabular-nums; margin: .35rem 0 .1rem; }
.le-count[hidden], .le-take[hidden] { display: none; }
.le-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .6rem 0 0; }
.le-nums div { background: var(--paper); border-radius: 10px; padding: .45rem .6rem; }
.le-nums dt { font-size: .78rem; color: var(--ink-soft); }
.le-nums dd { margin: 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.le-nums dd.is-up { color: var(--up); }
.le-nums dd.is-down { color: var(--down); }
.le-take { margin: .7rem 0 0; line-height: 1.6; }
.le-hist { margin: .6rem 0 0; font-size: .88rem; color: var(--ink-soft); line-height: 1.55; }
.le-hist[hidden] { display: none; }
.le-foot { margin: .6rem 0 0; font-size: .88rem; }

/* ───── Time Machine (/tools/time-machine) ───── */
.tm-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: calc(var(--gap) * 1.25); align-items: start; margin-bottom: calc(var(--gap) * 1.5); }
.tm-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.3rem; }
.tm-form .field:first-child, .tm-form .tm-run, .tm-form .calc-error { grid-column: 1 / -1; }
.tm-form select, .tm-form input { width: 100%; font-size: 1.05rem; font-weight: 600; }
.tm-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.tm-seg button { border: 0; background: var(--paper); padding: .55rem .4rem; font: inherit; font-weight: 600; color: var(--ink-soft); cursor: pointer; min-width: 0; }
.tm-seg button + button { border-left: 1px solid var(--rule); }
.tm-seg button.is-on { background: var(--brand); color: #fff; }
.tm-seg button.is-on.is-buy { background: var(--up); }
.tm-seg button.is-on.is-sell { background: var(--down); }
.tm-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tm-rr b { font-size: 1.25rem; display: block; }
.tm-run { width: 100%; justify-content: center; }
.tm-result { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.3rem; min-width: 0; }
.tm-empty { color: var(--ink-soft); margin: 0; }
.tm-verdict { font-family: var(--font-head); font-size: clamp(1.35rem, 3.4vw, 1.8rem); font-weight: 700; margin: 0; line-height: 1.25; }
.tm-v-strong_target, .tm-v-lean_target { color: var(--up); }
.tm-v-strong_stop, .tm-v-lean_stop { color: var(--down); }
.tm-v-breakeven, .tm-v-too_few { color: var(--gold-ink); }
.tm-verdict-sub { margin: .35rem 0 1rem; color: var(--ink-soft); }
.tm-odds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.tm-odds div { background: var(--paper); border-radius: 10px; padding: .55rem .65rem; min-width: 0; }
.tm-odds dt { font-size: .8rem; color: var(--ink-soft); }
.tm-odds dd { margin: .15rem 0 0; font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.tm-odds .is-up dd { color: var(--up); }
.tm-odds .is-down dd { color: var(--down); }
.tm-fan { margin: 0 0 .8rem; }
.tm-fan svg { width: 100%; height: 230px; display: block; background: var(--paper); border-radius: 10px; }
.tm-b90 { fill: var(--brand); opacity: .12; }
.tm-b50 { fill: var(--brand); opacity: .22; }
.tm-path { fill: none; stroke: var(--ink-soft); stroke-width: 1; opacity: .25; vector-effect: non-scaling-stroke; }
.tm-med { fill: none; stroke: var(--brand); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.tm-tp, .tm-sl, .tm-entry { stroke-width: 1.5; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.tm-tp { stroke: var(--up); }
.tm-sl { stroke: var(--down); }
.tm-entry { stroke: var(--ink-soft); }
.tm-fan figcaption { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .85rem; margin-top: .45rem; }
.tm-k { font-weight: 700; font-variant-numeric: tabular-nums; }
.tm-k-tp { color: var(--up); }
.tm-k-sl { color: var(--down); }
.tm-line { margin: .4rem 0; line-height: 1.55; }
@media (max-width: 760px) {
  .tm-wrap { grid-template-columns: minmax(0, 1fr); }
  .tm-odds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-form { padding: 1rem; }
  .tm-form select, .tm-form input { font-size: 16px; }
}

/* ───── งบการเงินหุ้น (SEC) ───── */
.stk-fund { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: .8rem; }
.stk-fund h2 { margin-top: 0; }
.stk-fund-kpis > div { background: var(--paper); border: 0; }
.stk-fund-kpis { grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); }
.stk-fund-ai { border-left: 3px solid var(--brand); padding: .2rem 0 .2rem .9rem; margin: .4rem 0 1rem; }
.stk-fund-ai h3 { font-size: 1rem; margin: 0 0 .3rem; }
.stk-fund-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stk-fund-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.stk-fund-table th, .stk-fund-table td { text-align: right; padding: .5rem .55rem; border-bottom: 1px solid var(--rule); vertical-align: top; font-variant-numeric: tabular-nums; }
.stk-fund-table th:first-child { text-align: left; }
.stk-fund-table thead th { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.stk-fund-table small { display: block; font-size: .76rem; color: var(--ink-soft); font-weight: 400; }
.stk-fund-table small.is-up { color: var(--up); }
.stk-fund-table small.is-down { color: var(--down); }
.stk-fund-bal { margin: .6rem 0 .3rem; }

/* ───── สวิตช์อนุมัติไม้ผ่าน Telegram ───── */
.apr-box { border-top: 1px solid var(--rule); margin-top: 1rem; padding-top: .9rem; display: grid; gap: .5rem; }
.apr-switch { display: flex; align-items: flex-start; gap: .75rem; cursor: pointer; }
.apr-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.apr-track { flex: 0 0 auto; width: 46px; height: 26px; border-radius: 999px; background: var(--rule); position: relative; transition: background .15s; margin-top: .1rem; }
.apr-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.apr-switch input:checked + .apr-track { background: var(--up); }
.apr-switch input:checked + .apr-track::after { transform: translateX(20px); }
.apr-switch input:focus-visible + .apr-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.apr-switch input:disabled + .apr-track { opacity: .5; }
.apr-label { display: grid; gap: .1rem; min-width: 0; }
.apr-label small { color: var(--ink-soft); }
.apr-tg { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
@media (prefers-reduced-motion: reduce) { .apr-track, .apr-track::after { transition: none; } }

/* ───── นักการเมืองสหรัฐฯ ซื้อขายหุ้น ───── */
.cg-warn { background: var(--gold-wash); color: var(--gold-ink); border-radius: var(--radius-sm); padding: .7rem 1rem; line-height: 1.55; margin: 1rem 0; }
.cg-top { margin: 1.2rem 0; }
.cg-top-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: .5rem; }
.cg-top-list li { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .55rem .75rem; display: grid; gap: .1rem; }
.cg-top-list b { font-size: 1.1rem; }
.cg-bs { font-size: .88rem; }
.cg-bs .is-up, .cg-type.is-up { color: var(--up); }
.cg-bs .is-down, .cg-type.is-down { color: var(--down); }
.cg-members { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .8rem 0 1rem; }
.cg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: .6rem; }
.cg-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
.cg-table th, .cg-table td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.cg-table thead th { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.cg-table small { display: block; font-size: .76rem; color: var(--ink-soft); }
.cg-table small.is-down { color: var(--down); }
.cg-asset small { max-width: 22rem; overflow-wrap: anywhere; }
.cg-type { font-weight: 700; white-space: nowrap; }
.cg-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ───── ปฏิทินงบ + เปรียบเทียบหุ้น ───── */
.ern-recent, .ern-cal { margin: 1.2rem 0; }
.ern-rel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: .5rem; }
.ern-rel summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: baseline; }
.ern-rel .prose { margin-top: .6rem; }
.ern-day { margin-bottom: 1rem; }
.ern-day h3 { font-size: 1rem; margin: 0 0 .4rem; }
.ern-day ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.ern-day li { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .5rem .75rem; display: flex; flex-wrap: wrap; gap: .25rem .7rem; align-items: baseline; }
.ern-name { color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.ern-time { font-size: .85rem; font-weight: 600; }
.ern-est { color: var(--gold-ink); }
.ern-next { margin: 0 0 .8rem; }
.ern-box { border-left: 4px solid var(--brand); }
.cmp-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .8rem; align-items: end; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.cmp-form label { display: grid; gap: .3rem; min-width: 0; }
.cmp-form label span { font-size: .85rem; color: var(--ink-soft); }
.cmp-form select { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .6rem .7rem; }
.cmp-form .button { min-height: 44px; }
.cmp-chart { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.cmp-chart h2 { margin-top: 0; }
.cmp-chart svg { width: 100%; height: 240px; display: block; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-weight: 700; margin-bottom: .4rem; }
.cmp-a { color: var(--brand); }
.cmp-b { color: var(--gold-ink); }
.cmp-base { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.cmp-line-a, .cmp-line-b { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.cmp-line-a { stroke: var(--brand); }
.cmp-line-b { stroke: var(--gold-ink); }
.cmp-table { width: 100%; border-collapse: collapse; min-width: 420px; background: var(--surface); border-radius: var(--radius); }
.cmp-table th, .cmp-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--rule); text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table th[scope="row"] { text-align: left; font-weight: 500; color: var(--ink-soft); }
.cmp-table thead th { font-size: 1.05rem; }
.cmp-table thead small { display: block; font-size: .78rem; color: var(--ink-soft); font-weight: 400; }
.cmp-table td.is-up { color: var(--up); }
.cmp-table td.is-down { color: var(--down); }
.cmp-sep th { padding-top: 1rem; color: var(--ink) !important; font-weight: 700 !important; }
.cmp-link { margin: .5rem 0; }
@media (max-width: 760px) {
  .cmp-form { grid-template-columns: minmax(0, 1fr); }
  .cmp-table { min-width: 0; font-size: .9rem; table-layout: fixed; }
  .cmp-table th, .cmp-table td { padding: .5rem .4rem; overflow-wrap: anywhere; }
  .cmp-table th[scope="row"] { width: 40%; }
}

/* ───── ผลงาน AI Trader ───── */
.aip-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.aip-mode { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; }
.aip-mode h2 { margin: 0 0 .6rem; font-size: 1.1rem; }
.aip-mode dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.aip-mode dl div { background: var(--paper); border-radius: 10px; padding: .45rem .6rem; min-width: 0; }
.aip-mode dt { font-size: .78rem; color: var(--ink-soft); }
.aip-mode dd { margin: 0; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.aip-mode dd.is-up { color: var(--up); } .aip-mode dd.is-down { color: var(--down); }
.aip-chart { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.aip-chart h2 { margin-top: 0; }
.aip-chart svg { width: 100%; height: 220px; display: block; }
.aip-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.aip-tables td.is-up { color: var(--up); } .aip-tables td.is-down { color: var(--down); }
.aip-list { margin: 1rem 0; }
.aip-r { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 4.2rem; }
.aip-r.is-up { color: var(--up); } .aip-r.is-down { color: var(--down); }
@media (max-width: 760px) { .aip-mode dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ลิงก์ Pro บนเมนูหลัก */
.main-nav .nav-pro { color: var(--gold-ink); font-weight: 700; }

/* ตารางนักการเมือง + งบการเงิน บนมือถือ: เป็นการ์ด ไม่ต้องเลื่อนข้าง */
@media (max-width: 760px) {
  .cg-table { min-width: 0; }
  .cg-table thead { display: none; }
  .cg-table, .cg-table tbody, .cg-table tr, .cg-table td { display: block; width: 100%; }
  .cg-table tr { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .5rem .7rem; margin-bottom: .5rem; }
  .cg-table td { border: 0; padding: .2rem 0 .2rem 7.2rem; position: relative; min-height: 1.4rem; overflow-wrap: anywhere; }
  .cg-table td::before { content: attr(data-label); position: absolute; left: 0; top: .25rem; width: 6.8rem; color: var(--ink-soft); font-size: .8rem; }
  .stk-fund-table { min-width: 0; font-size: .85rem; }
  .stk-fund-table th:last-child, .stk-fund-table td:last-child { display: none; }
  .stk-fund-table th, .stk-fund-table td { padding: .45rem .3rem; }
}

/* ───── ห้องถก AI ───── */
.dbt-room { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.2rem 1.3rem; margin: 1rem 0 1.5rem; }
.dbt-head h2 { margin: .15rem 0 .4rem; font-size: 1.35rem; line-height: 1.35; }
.dbt-kind { margin: 0; font-size: .85rem; color: var(--ink-soft); }
.dbt-q { margin: 0 0 .6rem; line-height: 1.6; }
.dbt-result { display: inline-block; margin: 0; padding: .35rem .7rem; border-radius: 8px; background: color-mix(in srgb, var(--ink) 6%, transparent); font-weight: 600; font-size: .92rem; }
.dbt-result.dbt-up { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.dbt-result.dbt-down { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
.dbt-result.is-wait { font-weight: 500; color: var(--ink-soft); }
.dbt-round { margin: 1.4rem 0 .6rem; font-size: 1rem; }
.dbt-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.dbt-say { display: grid; grid-template-columns: 2.6rem 1fr; gap: .6rem; align-items: start; }
.dbt-ava { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.dbt-bubble { min-width: 0; border: 1px solid var(--rule); border-left: 4px solid var(--dbt-c, var(--rule)); border-radius: 4px 12px 12px 12px; padding: .55rem .8rem .65rem; }
.dbt-bubble p { margin: 0; line-height: 1.65; overflow-wrap: anywhere; }
.dbt-bubble .dbt-who { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin-bottom: .25rem; font-size: .92rem; }
.dbt-p-bull { --dbt-c: var(--up); }
.dbt-p-bear { --dbt-c: var(--down); }
.dbt-p-macro { --dbt-c: #2563EB; }
.dbt-p-tech { --dbt-c: #D97706; }
.dbt-p-retail { --dbt-c: #9333EA; }
.dbt-stance { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.dbt-stance.dbt-up { background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); }
.dbt-stance.dbt-down { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.dbt-conf { font-size: .62rem; letter-spacing: 1px; color: var(--ink); }
.dbt-conf-off { opacity: .2; }
.dbt-mark { font-size: .8rem; font-weight: 600; }
.dbt-mark.is-right { color: var(--up); }
.dbt-mark.is-wrong { color: var(--down); }
.dbt-verdict { margin-top: 1.4rem; padding: .9rem 1rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dbt-verdict h3 { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: 0 0 .5rem; font-size: 1rem; }
.dbt-verdict p { margin: .4rem 0 0; line-height: 1.65; }
.dbt-lesson { padding-top: .5rem; border-top: 1px dashed var(--rule); }
.dbt-board { margin: 1.5rem 0; }
.dbt-board table { width: 100%; }
.dbt-past ul { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .5rem; }
.dbt-past li { display: grid; gap: .1rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.dbt-past li.is-current a { font-weight: 700; }
.le-debate { margin: .6rem 0 0; font-size: .92rem; font-weight: 600; }
@media (max-width: 760px) {
    .dbt-room { padding: .9rem .8rem 1rem; }
    .dbt-say { grid-template-columns: 2.1rem 1fr; gap: .45rem; }
    .dbt-ava { width: 2.1rem; height: 2.1rem; font-size: 1.1rem; }
}

.dbt-teaser { display: grid; gap: .45rem; margin-top: .9rem; padding: .9rem 1.1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.dbt-teaser:hover b { text-decoration: underline; }
.dbt-teaser-k { font-size: .82rem; color: var(--ink-soft); }
.dbt-teaser-row { display: flex; flex-wrap: wrap; gap: .35rem .7rem; }
.dbt-teaser-p { display: inline-flex; align-items: center; gap: .25rem; }
.dbt-teaser-v { font-size: .9rem; }
.cg-more { text-align: center; margin: 1rem 0; }

/* ───── ตลาดคริปโต ───── */
.cr-global { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; margin-top: .4rem; }
.cr-global > div { display: grid; gap: .1rem; }
.cr-global small { color: var(--navy-soft); font-size: .8rem; }
.cr-global b { color: #fff; font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.cr-global span { font-size: .85rem; font-family: var(--font-mono); }
.cr-fng { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.4rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; }
.cr-fng h2 { font-size: 1rem; margin: 0; }
.cr-fng p { margin: .2rem 0 0; }
.cr-fng-now { font-size: 1.3rem; font-weight: 700; }
.cr-gauge { position: relative; width: 170px; flex: none; }
.cr-gauge svg { width: 100%; display: block; }
.cr-gauge b { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-size: 1.5rem; font-family: var(--font-mono); }
.cr-g-track, .cr-g-fill { fill: none; stroke-width: 16; stroke-linecap: round; }
.cr-g-track { stroke: color-mix(in srgb, var(--ink) 10%, transparent); }
.cr-g-needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.cr-gauge circle { fill: var(--ink); }
.cr-table { width: 100%; border-collapse: collapse; }
.cr-table th, .cr-table td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--rule); font-size: .95rem; vertical-align: middle; }
.cr-table th { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.cr-table td a { display: grid; text-decoration: none; color: var(--ink); }
.cr-table td a small { color: var(--ink-soft); font-size: .8rem; }
.cr-table .cr-num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.cr-spark { width: 100px; height: 30px; display: block; }
.cr-spark polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.cr-spark .is-up { stroke: var(--up); }
.cr-spark .is-down { stroke: var(--down); }
.cr-news { margin: 1.2rem 0; }
.cr-news h2 { font-size: 1.1rem; }
.cr-news ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.cr-news li { display: grid; gap: .1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--rule); }
.cr-callout { background: var(--brand-wash); border-radius: var(--radius); padding: .7rem 1rem; }
@media (max-width: 760px) {
    .cr-hide-m { display: none; }
    .cr-table th, .cr-table td { padding: .5rem .45rem; font-size: .9rem; }
    .cr-gauge { width: 140px; }
}
.cr-cur { margin-top: .8rem; }
.cr-cur-small { margin-bottom: .4rem; }
.cr-alert-h { font-size: 1rem; margin: 0 0 .5rem; }
.dca-result { margin-top: 1rem; }
.dca-result h2 { font-size: 1.05rem; }
.dca-chart polyline { fill: none; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.dca-inv { stroke: var(--ink-soft); stroke-width: 1.6; stroke-dasharray: 5 4; }
.dca-legend-inv, .dca-legend-val { width: 1.1rem; display: inline-block; margin: 0 .25rem; vertical-align: middle; }
.dca-legend-inv { border-top: 2px dashed var(--ink-soft); }
.dca-legend-val { border-top: 2px solid var(--up); }
/* คริปโต: heatmap / เทียบสินทรัพย์ / พอร์ต */
.cr-hero-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 .4rem; }
.stk-tabs button { padding: .25rem .7rem; border-radius: 999px; border: 0; background: var(--brand-wash); color: var(--brand); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; }
.stk-tabs button.is-on { background: var(--brand); color: #fff; }
.cr-heat-wrap { margin-bottom: 1rem; }
.cr-heat-wrap h2 { font-size: 1.05rem; }
.cr-heat { position: relative; width: 100%; aspect-ratio: 5 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--rule); }
.cr-tile { position: absolute; box-sizing: border-box; border: 1px solid var(--paper, #fff); display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); overflow: hidden; line-height: 1.15; font-size: .72rem; }
.cr-tile b { font-size: .8rem; }
.cr-tile.is-big b { font-size: clamp(1rem, 2.4vw, 1.6rem); }
.cr-tile.is-big span { font-size: clamp(.8rem, 1.5vw, 1rem); }
.cr-tile.is-tiny span { display: none; }
.cr-tile:hover, .cr-tile:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; z-index: 1; }
.cr-cmp h2 { font-size: 1.05rem; margin: 0; }
.cr-cmp polyline { fill: none; stroke-width: 2.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.cr-cmp-base { stroke: var(--rule); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
polyline.cr-cmp-btc { stroke: #F7931A; }
polyline.cr-cmp-gold { stroke: #CA8A04; }
polyline.cr-cmp-sp500 { stroke: #2563EB; }
.cr-cmp-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; justify-content: center; }
.cr-cmp-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.cr-cmp-dot.cr-cmp-btc { background: #F7931A; }
.cr-cmp-dot.cr-cmp-gold { background: #CA8A04; }
.cr-cmp-dot.cr-cmp-sp500 { background: #2563EB; }
.pf-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin: 0 0 1rem; background: var(--rule); }
.pf-bar span { display: block; height: 100%; }
.pf-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.pf-form { margin-top: 1rem; }
.pf-ai { margin: 1.2rem 0; padding: .9rem 1rem; border-radius: var(--radius); background: var(--brand-wash); }
.pf-ai h2 { font-size: 1rem; margin: 0 0 .5rem; }
@media (max-width: 760px) {
    .cr-heat { aspect-ratio: 1 / 1; }
    .cr-tile { font-size: .62rem; }
}
.cr-halving { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.cr-halving h2 { font-size: 1rem; margin: 0 0 .3rem; }
.cr-halving-big { font-size: 1.25rem; font-weight: 700; margin: 0; }
.cr-halving ul { margin: .4rem 0; padding-left: 1.1rem; }
/* ราคาทองไทย/ลาว */
.gp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: .8rem; margin-bottom: 1rem; }
.gp-grid.is-lao-first .gp-lao { order: -1; }
.gp-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1.1rem; }
.gp-card h2 { font-size: 1.05rem; margin: 0 0 .3rem; }
.gp-big { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 700; font-family: var(--font-mono); margin: 0; }
.gp-big small { font-size: .9rem; font-family: var(--font); font-weight: 500; color: var(--ink-soft); }
.gp-table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.gp-table th, .gp-table td { padding: .4rem 0; border-bottom: 1px solid var(--rule); font-size: .95rem; }
.gp-table th { text-align: left; font-weight: 500; color: var(--ink-soft); }
.gp-table td { text-align: right; font-family: var(--font-mono); }
.gp-chart-h { font-size: 1rem; margin: .5rem 0 0; }
.gp-teaser-row { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.gp-teaser-row > span { display: grid; }
.gp-teaser-row small { color: var(--ink-soft); font-size: .78rem; }
.gp-teaser-row b { font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.gp-teaser-row i { font-style: normal; font-size: .8rem; }
.gp-teaser-row.is-lao-first .gp-t-lo { order: -1; }
.gp-calc { margin: 1.5rem 0; padding: 1.1rem 1.2rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.gp-calc h2 { margin: 0 0 .8rem; font-size: 1.1rem; }
.gp-calc-form { display: flex; flex-wrap: wrap; gap: .7rem 1rem; }
.gp-calc-form label { display: grid; gap: .25rem; flex: 1 1 140px; }
.gp-calc-form label span { font-size: .85rem; color: var(--ink-soft); }
.gp-calc-form input, .gp-calc-form select { font-size: 16px; min-width: 0; }
.gp-calc-out { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; margin: 1rem 0 .4rem; }
.gp-calc-out > div { display: grid; }
.gp-calc-out small { color: var(--ink-soft); font-size: .8rem; }
.gp-calc-out b { font-variant-numeric: tabular-nums; font-size: 1.3rem; }
.gp-calc-out.is-lao-first .gp-c-lo { order: -1; }
.fx-swap { align-self: end; min-width: 2.6rem; }
.fx-conv-out { margin: 1rem 0 .3rem; }
.fx-conv-out b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.fx-table-wrap { margin: 1.5rem 0; overflow-x: auto; }
.fx-table th[scope="row"] { text-align: left; white-space: nowrap; font-weight: 400; }
@media (max-width: 760px) { .fx-table th[scope="row"] small { display: none; } }
.hot-jump { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .8rem; font-size: .92rem; }
.hot-sec { margin: 1.8rem 0; scroll-margin-top: 5rem; }
.hot-sec h2 { margin-bottom: .2rem; }
.hot-danger { border-color: var(--down); background: color-mix(in srgb, var(--down) 7%, var(--surface)); }
.hot-table td a b { white-space: nowrap; }
.hot-table .is-sort { font-weight: 700; background: color-mix(in srgb, var(--accent) 5%, transparent); }
.hot-sub { margin: 1.4rem 0 .2rem; font-size: 1.05rem; }
.hot-note { margin-top: .3rem; font-size: .86rem; max-width: 34rem; }
.hot-note summary { cursor: pointer; color: var(--link); white-space: nowrap; }
.hot-note p { margin: .35rem 0; white-space: normal; }
.hot-note-risk { color: var(--down); }
.hot-lv { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 999px; font-size: .72rem; color: #fff; background: #F97316; }
.hot-lv-high { background: #EAB308; color: #1F1F1F; }
.hot-lv-extreme { background: var(--down); }
.cr-coin-note { margin: 1rem 0; padding: .8rem 1rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.cr-coin-note .hot-note { max-width: none; font-size: .95rem; }
.ts-check { margin: 1.4rem 0; padding: 1rem 1.2rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.ts-check h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.ts-grade { font-weight: 700; margin: 0 0 .8rem; }
.ts-grade-danger { border-color: var(--down); }
.ts-grade-danger .ts-grade { color: var(--down); }
.ts-check ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.ts-check li { display: flex; gap: .6rem; align-items: flex-start; }
.ts-check li small { color: var(--ink-soft); }
.ts-ico { flex: 0 0 1.4rem; text-align: center; }
.ts-fail b { color: var(--down); }
.ca-box { margin: 1.4rem 0; padding: 1rem 1.2rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.ca-box h2 { margin: 0 0 .5rem; font-size: 1.1rem; }
.ca-box h3 { margin: .9rem 0 .3rem; font-size: .98rem; }
.ca-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ca-lines { white-space: pre-line; margin: 0; }
.ca-bad h3 { color: var(--down); }
.ca-verdict { font-weight: 600; }
@media (max-width: 760px) { .ca-cols { grid-template-columns: 1fr; } }
