/* =========================================================
   พื้นที่สมาชิก (ตามดีไซน์ Figma): หัวเว็บแอป, ภาพรวม, บันทึกเทรด, เรียนรู้, เครื่องมือ
   ========================================================= */
body:has(.mh) { background: #F3F6F4; }
.member-main { max-width: 76rem; }

/* ---------- หัวเว็บสมาชิก ---------- */
.mh { background: rgba(255, 255, 255, .92); }
.mh-inner { height: 4.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.mh .brand { flex: none; text-decoration: none; }
.mh-nav { display: flex; align-items: center; gap: .35rem; }
.mh-nav a {
    padding: .55rem .9rem; border-radius: 10px; color: #475569; font-family: var(--font-head); font-size: .9rem; font-weight: 600;
    text-decoration: none; transition: color .15s, background .15s;
}
.mh-nav a:hover { color: #065F46; background: #F1F5F3; }
.mh-nav a.on { color: #065F46; font-weight: 700; }
.mh-actions { display: flex; align-items: center; gap: .6rem; }
.mh-install {
    display: inline-flex; align-items: center; gap: .5rem; height: 2.6rem; padding: 0 1rem; border-radius: 12px;
    border: 1px solid #A7F3D0; background: #ECFDF5; color: #065F46; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.mh-install[hidden] { display: none; }
.mh-install:hover { background: #D1FAE5; }
.mh-install svg, .mh-icon svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.mh-pop { position: relative; }
.mh-pop > summary { list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mh-pop > summary::-webkit-details-marker { display: none; }
.mh-icon { position: relative; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 12px; color: #475569; }
.mh-icon:hover, .mh-pop[open] > .mh-icon { background: #F1F5F3; color: #065F46; }
.mh-badge {
    position: absolute; top: .3rem; right: .25rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 999px;
    display: grid; place-items: center; background: #E11D48; color: #fff; font-size: .62rem; font-weight: 800; box-shadow: 0 0 0 2px #fff;
}
.mh-avatar {
    width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 12px;
    background: #D1FAE5; color: #065F46; font-weight: 800; font-size: .9rem;
}
.mh-pop[open] > .mh-avatar { box-shadow: 0 0 0 3px #A7F3D0; }
.mh-panel {
    position: absolute; right: 0; top: calc(100% + .6rem); z-index: 70; width: min(22rem, calc(100vw - 2rem));
    background: #fff; color: #172420; border: 1px solid #E2E8F0; border-radius: 18px; padding: .75rem;
    box-shadow: 0 20px 50px rgba(15, 50, 42, .16); animation: mh-in .16s ease-out;
}
@keyframes mh-in { from { opacity: 0; transform: translateY(-4px); } }
.mh-panel-title { margin: .25rem .4rem .6rem; font-weight: 700; font-size: .95rem; }
.mh-empty { margin: .25rem .4rem .75rem; font-size: .85rem; color: #64748B; line-height: 1.6; }
.mh-notes { list-style: none; margin: 0; padding: 0; max-height: min(24rem, 60vh); overflow-y: auto; }
.mh-note > a, .mh-note > div {
    display: flex; gap: .65rem; padding: .65rem .5rem; border-radius: 12px; color: inherit; text-decoration: none;
}
.mh-note > a:hover { background: #F6F8F7; }
.mh-note-dot { flex: none; width: .55rem; height: .55rem; margin-top: .45rem; border-radius: 50%; background: #CBD5E1; }
.mh-note.tone-bad .mh-note-dot { background: #E11D48; }
.mh-note.tone-warn .mh-note-dot { background: #F59E0B; }
.mh-note.tone-info .mh-note-dot { background: #10B981; }
.mh-note:not(.is-new) .mh-note-dot { opacity: .35; }
.mh-note-body { min-width: 0; display: grid; gap: .15rem; }
.mh-note-body b { font-size: .85rem; }
.mh-note-body span { font-size: .8rem; color: #475569; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.mh-note-body small { font-size: .7rem; color: #94A3B8; }
.mh-seen { display: none; }
.mh-panel-foot { display: block; margin-top: .4rem; padding: .6rem .5rem 0; border-top: 1px solid #F1F5F9; font-size: .82rem; font-weight: 700; color: #047857; text-decoration: none; }
.mh-user-panel { width: 16rem; display: grid; gap: .1rem; }
.mh-user-name { margin: .2rem .5rem .5rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-user-panel > a, .mh-logout {
    display: block; width: 100%; text-align: left; padding: .6rem .5rem; border-radius: 10px; border: 0; background: none;
    color: #334155; font: inherit; font-size: .88rem; text-decoration: none; cursor: pointer;
}
.mh-user-panel > a:hover, .mh-logout:hover { background: #F6F8F7; color: #065F46; }
.mh-user-panel .lang-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: .2rem; margin: .4rem 0; padding: .2rem; border-radius: 10px; background: #F1F5F3; }
.mh-user-panel .lang-switch a { text-align: center; padding: .4rem; border-radius: 8px; font-size: .8rem; color: #475569; text-decoration: none; }
.mh-user-panel .lang-switch a[aria-current="true"] { background: #fff; color: #065F46; font-weight: 700; box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.mh-user-panel form { margin: 0; border-top: 1px solid #F1F5F9; padding-top: .2rem; }
.mh-logout { color: #BE123C; }

.member-foot { padding: 1.5rem 0 2rem; font-size: .75rem; color: #94A3B8; }
.member-foot p { margin: .2rem 0; }
.member-foot a { color: inherit; }

/* ---------- หัวหน้าแต่ละหน้า ---------- */
.mp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1.5rem; }
.mp-kicker, .hub-kicker { margin: 0 0 .35rem; color: #047857; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.mp-head h1, .journal-head h1 { margin: 0; font-family: var(--font-head); font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 700; color: #10251F; letter-spacing: -.02em; }
.mp-desc { margin: .4rem 0 0; font-size: .88rem; color: #64748B; }
.mp-head .button { border-radius: 12px; }

/* ---------- การ์ดกลาง ---------- */
.hub-card, .me-card, .j-chart, .j-insights, .journal-section, .journal-filters, .jtabs {
    background: #fff; border: 1px solid rgba(226, 232, 240, .85); border-radius: 22px; box-shadow: 0 6px 24px rgba(20, 55, 46, .04);
}
.hub-card { padding: 1.4rem 1.5rem; display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.hub-card h2 { margin: 0; font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; color: #10251F; }
.hub-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.hub-link { align-self: flex-start; margin-top: auto; color: #047857; font-size: .85rem; font-weight: 700; text-decoration: none; }
.hub-link::after { content: " →"; }
.hub-link:hover { color: #065F46; text-decoration: underline; }

/* ---------- ภาพรวม: หัว ---------- */
.hub-hero {
    display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    margin: .25rem 0 1rem; padding: 1.75rem 2rem; border-radius: 28px; color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, #14513F 0%, transparent 55%), linear-gradient(135deg, #092B25, #0C302A);
}
.hub-me { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.hub-avatar { flex: none; width: 3.5rem; height: 3.5rem; display: grid; place-items: center; border-radius: 16px; background: #34D399; color: #092B25; font-weight: 800; font-size: 1.3rem; }
.hub-hi { margin: 0; font-size: .8rem; color: #6EE7B7; }
.hub-hero h1 { margin: .1rem 0 .2rem; font-family: var(--font-head); font-size: clamp(1.4rem, 3vw, 1.75rem); color: #fff; overflow-wrap: anywhere; }
.hub-since { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .75rem; color: rgba(255, 255, 255, .55); }
.hub-pro { padding: .15rem .55rem; border-radius: 999px; background: rgba(232, 111, 62, .2); color: #FDBA74; font-weight: 700; text-decoration: none; }
.hub-today { flex: 0 1 28rem; padding: 1rem 1.15rem; border-radius: 18px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.hub-today-title { margin: 0 0 .6rem; font-size: .78rem; font-weight: 700; color: #6EE7B7; }
.hub-today-title small { margin-left: .35rem; font-weight: 500; color: rgba(255, 255, 255, .45); }
.hub-today dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.hub-today dt { font-size: .68rem; color: rgba(255, 255, 255, .55); }
.hub-today dd { margin: .2rem 0 0; font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; color: #fff; white-space: nowrap; }
.hub-today dd.pos { color: #6EE7B7; }
.hub-today dd.neg { color: #FDA4AF; }
.hub-today dd a { color: #6EE7B7; font-size: .9rem; }
.hub-today .hub-stop { color: #FDA4AF; font-size: .9rem; white-space: normal; }

.hub-plan {
    display: flex; align-items: center; gap: 1rem; margin: 0 0 1rem; padding: 1rem 1.25rem; border-radius: 18px;
    background: #FFF7ED; border: 1px solid #FED7AA;
}
.hub-plan > div { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.hub-plan b { font-size: .92rem; color: #7C2D12; }
.hub-plan small { font-size: .78rem; color: #C2410C; }
.hub-plan-tag { flex: none; padding: .3rem .55rem; border-radius: 8px; background: #E86F3E; color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .05em; }
.hub-plan .button { flex: none; border-radius: 12px; }

.hub-insight {
    display: flex; align-items: flex-start; gap: 1rem; margin: 0 0 1rem; padding: 1.15rem 1.35rem; border-radius: 22px;
    background: #fff; border: 1px solid rgba(226, 232, 240, .85); box-shadow: 0 6px 24px rgba(20, 55, 46, .04);
}
.hub-insight > div { flex: 1; min-width: 0; }
.hub-insight-ico { flex: none; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 12px; background: #FFF1F2; color: #E11D48; }
.hub-insight.tone-good .hub-insight-ico { background: #ECFDF5; color: #059669; }
.hub-insight-ico svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.hub-insight-text { margin: 0; font-weight: 700; font-size: .98rem; color: #10251F; line-height: 1.55; }
.hub-insight-tip { margin: .3rem 0 0; font-size: .85rem; color: #64748B; }
.hub-insight .hub-link { align-self: center; margin: 0; white-space: nowrap; }

.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.hub-progress-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; font-weight: 700; }
.hub-progress-head small { font-weight: 500; color: #94A3B8; }
.hub-meter { height: .55rem; border-radius: 999px; background: #EEF2F0; overflow: hidden; }
.hub-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #059669, #10B981); }
.hub-next { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: 14px; background: #F6F8F7; border: 1px solid #EEF2F0; color: inherit; text-decoration: none; }
.hub-next:hover { border-color: #A7F3D0; background: #F0FDF4; }
.hub-next-step { flex: none; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 10px; background: #065F46; color: #fff; font-weight: 800; }
.hub-next b { display: block; font-size: .9rem; line-height: 1.4; }
.hub-next small { font-size: .74rem; color: #64748B; }

.hub-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-radius: 14px; border: 1px solid #EEF2F0; overflow: hidden; }
.hub-stats > div { padding: .8rem .9rem; border-right: 1px solid #EEF2F0; border-bottom: 1px solid #EEF2F0; min-width: 0; }
.hub-stats > div:nth-child(3n) { border-right: 0; }
.hub-stats > div:nth-last-child(-n+3) { border-bottom: 0; }
.hub-stats dt { font-size: .7rem; color: #94A3B8; }
.hub-stats dd { margin: .25rem 0 0; font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; color: #10251F; white-space: nowrap; }
.hub-stats dd.pos, .j-mini dd.pos { color: #059669; }
.hub-stats dd.neg, .j-mini dd.neg { color: #E11D48; }
.hub-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.hub-actions .button { border-radius: 12px; }
.hub-accts { display: flex; flex-wrap: wrap; gap: .4rem; text-decoration: none; }
.hub-accts .acct-chip { pointer-events: none; }

.hub-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.hub-tiles a, .mt-tile, .ml-topics a {
    display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; padding: .9rem; border-radius: 16px;
    background: #F6F8F7; border: 1px solid #EEF2F0; color: #10251F; text-decoration: none; transition: border-color .15s, transform .15s;
}
.hub-tiles a:hover, .mt-tile:hover, .ml-topics a:hover { border-color: #A7F3D0; transform: translateY(-2px); }
.hub-tiles b, .mt-tile b { font-size: .88rem; }
.hub-tile-ico { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 11px; background: #fff; color: #047857; box-shadow: 0 1px 3px rgba(15, 50, 42, .08); }
.hub-tile-ico svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- กราฟกำไรสะสม ---------- */
.eq-plot { position: relative; }
.eq .equity-chart { height: 13rem; border: 0; border-radius: 0; background: none; overflow: visible; }
.eq-compact .equity-chart { height: 10rem; }
.eq-area { opacity: .14; }
.eq.is-pos .eq-area { fill: #059669; }
.eq.is-neg .eq-area { fill: #E11D48; }
.eq .equity-zero { stroke: #CBD5E1; }
.eq-ylab { position: absolute; left: 0; transform: translateY(-50%); padding: 0 .3rem; border-radius: 6px; background: rgba(255, 255, 255, .85); font-size: .66rem; font-weight: 600; color: #94A3B8; pointer-events: none; }
.eq-ylab-zero { color: #64748B; }
.eq-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: #CBD5E1; pointer-events: none; }
.eq-dot { position: absolute; width: .7rem; height: .7rem; margin: -.35rem 0 0 -.35rem; border-radius: 50%; background: #fff; border: 2px solid #059669; pointer-events: none; }
.eq.is-neg .eq-dot { border-color: #E11D48; }
.eq-tip {
    position: absolute; top: -.4rem; transform: translate(-50%, -100%); padding: .3rem .55rem; border-radius: 8px;
    background: #0F172A; color: #fff; font-size: .72rem; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.eq-tip.is-neg { color: #FDA4AF; }
.eq-cursor[hidden], .eq-dot[hidden], .eq-tip[hidden] { display: none; }
.eq .equity-axis { align-items: center; font-size: .72rem; color: #94A3B8; }
.eq-last { font-weight: 800; font-size: .8rem; }
.eq-last.pos { color: #059669; }
.eq-last.neg { color: #E11D48; }
.eq[data-eq] { touch-action: pan-y; cursor: crosshair; }

/* ---------- บันทึกเทรด ---------- */
.journal-head { align-items: flex-end; }
.journal-head .mp-desc { margin-bottom: .2rem; }
.journal-filters { padding: .6rem .7rem; border-radius: 18px; }
.journal-filters .chip { border-radius: 10px; }
.journal-filters .chip.on { background: #065F46; border-color: #065F46; color: #fff; }
.jtabs { border-radius: 18px; padding: .35rem; }
.jtab { border-radius: 13px; }
.jtab.on { background: #0C302A; color: #fff; }
.journal-section { padding: 1.25rem 1.4rem; }
.journal-section > h2, .j-chart h2 { font-family: var(--font-head); font-size: 1.15rem; }
.journal-top { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.journal-top .journal-section { margin: 0; }
.j-kpi { border-radius: 22px; overflow: hidden; background: #fff; border: 1px solid rgba(226, 232, 240, .85); box-shadow: 0 6px 24px rgba(20, 55, 46, .04); }
.j-kpi-main { padding: 1.35rem 1.4rem 1.5rem; background: linear-gradient(135deg, #092B25, #0C302A); color: rgba(255, 255, 255, .6); font-size: .78rem; }
.j-kpi-main b { display: block; margin-top: .35rem; font-family: var(--font-head); font-size: clamp(1.9rem, 4vw, 2.4rem); color: #fff; }
.j-kpi-main b.pos { color: #6EE7B7; }
.j-kpi-main b.neg { color: #FDA4AF; }
.j-kpi-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.j-kpi-grid > div { padding: .95rem 1.1rem; border-right: 1px solid #EEF2F0; border-bottom: 1px solid #EEF2F0; min-width: 0; }
.j-kpi-grid > div:nth-child(3n) { border-right: 0; }
.j-kpi-grid > div:nth-last-child(-n+3) { border-bottom: 0; }
.j-kpi-grid dt, .j-mini dt { font-size: .7rem; color: #94A3B8; }
.j-kpi-grid dd { margin: .3rem 0 0; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.j-kpi-grid dd.pos { color: #059669; }
.j-kpi-grid dd.neg { color: #E11D48; }
.j-mini { margin: 0 0 .5rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.j-mini > div { padding: 1.1rem 1.25rem; border-radius: 20px; background: #fff; border: 1px solid rgba(226, 232, 240, .85); box-shadow: 0 6px 24px rgba(20, 55, 46, .04); min-width: 0; }
.j-mini dd { margin: .45rem 0 0; font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-exp { margin: 0 0 1rem .25rem; }

.j-insights { margin: 0 0 1rem; padding: 1.1rem 1.35rem; }
.j-insights h2 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .75rem; font-family: var(--font-head); font-size: 1.05rem; }
.j-insights h2 svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: #047857; stroke-width: 1.9; stroke-linecap: round; }
.j-insights ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.j-insights li { display: grid; gap: .15rem; padding: .75rem .9rem .75rem 1rem; border-radius: 14px; background: #FFF5F6; border-left: 3px solid #E11D48; }
.j-insights li.tone-good { background: #F0FDF4; border-left-color: #059669; }
.j-insights b { font-size: .9rem; color: #10251F; line-height: 1.5; }
.j-insights span { font-size: .8rem; color: #64748B; }

.guard-card { padding: 1.15rem 1.35rem; margin-bottom: 1rem; border-radius: 22px; border-left-width: 4px; box-shadow: 0 6px 24px rgba(20, 55, 46, .04); }

/* ---------- เรียนรู้ ---------- */
.ml-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.ml-side { display: grid; gap: 1rem; }
.ml-badge { flex: none; padding: .3rem .65rem; border-radius: 999px; background: #FFF7ED; color: #C2410C; font-size: .72rem; font-weight: 700; }
.ml-badge.is-done { background: #ECFDF5; color: #047857; }
.ml-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.ml-list a { display: flex; align-items: center; gap: .8rem; padding: .7rem .75rem; border-radius: 14px; border: 1px solid transparent; color: inherit; text-decoration: none; }
.ml-list a:hover { background: #F6F8F7; border-color: #EEF2F0; }
.ml-step { flex: none; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: 10px; background: #F1F5F3; color: #64748B; font-weight: 800; font-size: .85rem; }
.ml-list .is-done .ml-step { background: #D1FAE5; color: #047857; }
.ml-list .is-next a { background: #F0FDF4; border-color: #A7F3D0; }
.ml-list .is-next .ml-step { background: #065F46; color: #fff; }
.ml-title { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.ml-title b { font-size: .9rem; line-height: 1.45; font-weight: 600; }
.ml-title small { font-size: .72rem; color: #94A3B8; }
.ml-list .is-next .ml-title small { color: #047857; font-weight: 700; }
.ml-go { color: #CBD5E1; font-size: 1.3rem; line-height: 1; }
.ml-tutor { background: linear-gradient(160deg, #ECFDF5, #fff 60%); }
.ml-topics { display: grid; gap: .5rem; }
.ml-topics a { flex-direction: row; align-items: center; padding: .65rem .8rem; }
.ml-topics a b { flex: 1; font-size: .88rem; }

/* ---------- เครื่องมือ ---------- */
.mt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.mt-calc .hm-calc { border: 1px solid rgba(226, 232, 240, .85); box-shadow: 0 6px 24px rgba(20, 55, 46, .05); border-radius: 22px; }
.mt-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.mt-tile { background: #fff; padding: 1.1rem; border-radius: 20px; }
.mt-tile small { font-size: .74rem; color: #64748B; line-height: 1.5; }
.mt-tile .hub-tile-ico { background: #ECFDF5; box-shadow: none; }

/* ---------- ตั้งค่าบัญชี ---------- */
.me-card { border-radius: 22px; padding: 1.35rem 1.5rem; }
.me-danger { border-radius: 18px; }

/* ---------- มือถือ ---------- */
@media (max-width: 1024px) {
    .mh-nav { display: none; }
    .ml-grid, .mt-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .mh-inner { height: 4rem; gap: .75rem; }
    .mh-install span { display: none; }
    .mh-install { width: 2.6rem; padding: 0; justify-content: center; }
    .mh-panel { position: fixed; left: .75rem; right: .75rem; top: 4.4rem; width: auto; }
    .member-foot { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
    .bn-member { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    .hub-hero { padding: 1.25rem; border-radius: 22px; gap: 1rem; }
    .hub-avatar { width: 3rem; height: 3rem; font-size: 1.1rem; border-radius: 14px; }
    .hub-today { flex: 1 1 100%; padding: .85rem; }
    .hub-today dd { font-size: 1rem; }
    .hub-plan { flex-wrap: wrap; }
    .hub-plan .button { width: 100%; justify-content: center; }
    .hub-insight { flex-wrap: wrap; padding: 1rem; }
    .hub-insight > div { flex: 1 1 calc(100% - 3.8rem); }
    .hub-insight .hub-link { margin-left: 3.6rem; white-space: normal; }
    .hub-grid { grid-template-columns: minmax(0, 1fr); }
    .hub-card { padding: 1.15rem; border-radius: 20px; }
    .hub-stats dd { font-size: 1rem; }
    .hub-stats > div { padding: .7rem; }

    .journal-top { grid-template-columns: minmax(0, 1fr); }
    .j-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .j-mini > div { padding: .9rem 1rem; border-radius: 16px; }
    .j-kpi-grid > div { padding: .8rem .75rem; }
    .j-kpi-grid dd { font-size: .95rem; }
    .journal-section { padding: 1.1rem; }
    .jtabs { border-radius: 16px; }

    .mt-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
    .mt-tile { padding: .9rem; }
    .mp-head { margin-top: 0; }
    .mp-head .button { width: 100%; justify-content: center; }
}

/* ---------- โหมดมืด ---------- */
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] body:has(.mh) { background: var(--paper); }
    html[data-theme="auto"] .mh { background: rgba(17, 34, 30, .92); }
    html[data-theme="auto"] .mh-nav a, html[data-theme="auto"] .mh-icon { color: var(--ink-soft); }
    html[data-theme="auto"] .mh-nav a:hover, html[data-theme="auto"] .mh-nav a.on, html[data-theme="auto"] .mh-icon:hover, html[data-theme="auto"] .mh-pop[open] > .mh-icon { color: var(--mint); background: rgba(255, 255, 255, .05); }
    html[data-theme="auto"] .mh-panel { background: var(--surface); color: var(--ink); border-color: var(--rule); }
    html[data-theme="auto"] .mh-note > a:hover, html[data-theme="auto"] .mh-user-panel > a:hover, html[data-theme="auto"] .mh-logout:hover { background: rgba(255, 255, 255, .05); }
    html[data-theme="auto"] .mh-note-body span, html[data-theme="auto"] .mh-user-panel > a, html[data-theme="auto"] .mh-logout { color: var(--ink-soft); }
    html[data-theme="auto"] .mh-user-panel .lang-switch { background: var(--paper); }
    html[data-theme="auto"] .mh-user-panel .lang-switch a[aria-current="true"] { background: var(--surface); color: var(--mint); }
    html[data-theme="auto"] .mh-badge { box-shadow: 0 0 0 2px var(--surface); }
    html[data-theme="auto"] .mp-head h1, html[data-theme="auto"] .journal-head h1, html[data-theme="auto"] .hub-card h2, html[data-theme="auto"] .hub-insight-text, html[data-theme="auto"] .j-insights b, html[data-theme="auto"] .hub-stats dd, html[data-theme="auto"] .hub-tiles a, html[data-theme="auto"] .mt-tile, html[data-theme="auto"] .ml-topics a { color: var(--ink); }
    html[data-theme="auto"] .hub-card, html[data-theme="auto"] .me-card, html[data-theme="auto"] .j-chart, html[data-theme="auto"] .j-insights, html[data-theme="auto"] .journal-section, html[data-theme="auto"] .journal-filters, html[data-theme="auto"] .jtabs, html[data-theme="auto"] .hub-insight, html[data-theme="auto"] .j-kpi, html[data-theme="auto"] .j-mini > div, html[data-theme="auto"] .mt-tile {
        background: var(--surface); border-color: var(--rule); box-shadow: none;
    }
    html[data-theme="auto"] .hub-next, html[data-theme="auto"] .hub-tiles a, html[data-theme="auto"] .ml-topics a, html[data-theme="auto"] .hub-stats, html[data-theme="auto"] .hub-stats > div, html[data-theme="auto"] .j-kpi-grid > div { background: transparent; border-color: var(--rule); }
    html[data-theme="auto"] .hub-meter { background: var(--rule); }
    html[data-theme="auto"] .j-insights li { background: rgba(225, 29, 72, .08); }
    html[data-theme="auto"] .j-insights li.tone-good { background: rgba(5, 150, 105, .1); }
    html[data-theme="auto"] .hub-plan { background: var(--gold-wash); border-color: #5A3423; }
    html[data-theme="auto"] .hub-plan b { color: #FED7AA; }
    html[data-theme="auto"] .eq-ylab { background: rgba(17, 34, 30, .85); }
    html[data-theme="auto"] .ml-list .is-next a { background: var(--brand-wash); border-color: var(--rule); }
    html[data-theme="auto"] .ml-tutor { background: var(--surface); }
}
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] body:has(.mh) { background: var(--paper); }
    html[data-theme="dark"] .mh { background: rgba(17, 34, 30, .92); }
    html[data-theme="dark"] .mh-nav a, html[data-theme="dark"] .mh-icon { color: var(--ink-soft); }
    html[data-theme="dark"] .mh-nav a:hover, html[data-theme="dark"] .mh-nav a.on, html[data-theme="dark"] .mh-icon:hover, html[data-theme="dark"] .mh-pop[open] > .mh-icon { color: var(--mint); background: rgba(255, 255, 255, .05); }
    html[data-theme="dark"] .mh-panel { background: var(--surface); color: var(--ink); border-color: var(--rule); }
    html[data-theme="dark"] .mh-note > a:hover, html[data-theme="dark"] .mh-user-panel > a:hover, html[data-theme="dark"] .mh-logout:hover { background: rgba(255, 255, 255, .05); }
    html[data-theme="dark"] .mh-note-body span, html[data-theme="dark"] .mh-user-panel > a, html[data-theme="dark"] .mh-logout { color: var(--ink-soft); }
    html[data-theme="dark"] .mh-user-panel .lang-switch { background: var(--paper); }
    html[data-theme="dark"] .mh-user-panel .lang-switch a[aria-current="true"] { background: var(--surface); color: var(--mint); }
    html[data-theme="dark"] .mh-badge { box-shadow: 0 0 0 2px var(--surface); }
    html[data-theme="dark"] .mp-head h1, html[data-theme="dark"] .journal-head h1, html[data-theme="dark"] .hub-card h2, html[data-theme="dark"] .hub-insight-text, html[data-theme="dark"] .j-insights b, html[data-theme="dark"] .hub-stats dd, html[data-theme="dark"] .hub-tiles a, html[data-theme="dark"] .mt-tile, html[data-theme="dark"] .ml-topics a { color: var(--ink); }
    html[data-theme="dark"] .hub-card, html[data-theme="dark"] .me-card, html[data-theme="dark"] .j-chart, html[data-theme="dark"] .j-insights, html[data-theme="dark"] .journal-section, html[data-theme="dark"] .journal-filters, html[data-theme="dark"] .jtabs, html[data-theme="dark"] .hub-insight, html[data-theme="dark"] .j-kpi, html[data-theme="dark"] .j-mini > div, html[data-theme="dark"] .mt-tile {
        background: var(--surface); border-color: var(--rule); box-shadow: none;
    }
    html[data-theme="dark"] .hub-next, html[data-theme="dark"] .hub-tiles a, html[data-theme="dark"] .ml-topics a, html[data-theme="dark"] .hub-stats, html[data-theme="dark"] .hub-stats > div, html[data-theme="dark"] .j-kpi-grid > div { background: transparent; border-color: var(--rule); }
    html[data-theme="dark"] .hub-meter { background: var(--rule); }
    html[data-theme="dark"] .j-insights li { background: rgba(225, 29, 72, .08); }
    html[data-theme="dark"] .j-insights li.tone-good { background: rgba(5, 150, 105, .1); }
    html[data-theme="dark"] .hub-plan { background: var(--gold-wash); border-color: #5A3423; }
    html[data-theme="dark"] .hub-plan b { color: #FED7AA; }
    html[data-theme="dark"] .eq-ylab { background: rgba(17, 34, 30, .85); }
    html[data-theme="dark"] .ml-list .is-next a { background: var(--brand-wash); border-color: var(--rule); }
    html[data-theme="dark"] .ml-tutor { background: var(--surface); }


/* ---------- ชวนเพื่อน ---------- */
.hub-invite {
    display: flex; align-items: center; gap: .9rem; margin: 0 0 1rem; padding: .95rem 1.2rem; border-radius: 20px;
    background: linear-gradient(120deg, #FFF7ED, #FEF3C7); border: 1px solid #FDE68A; color: #78350F; text-decoration: none;
}
.hub-invite:hover { border-color: #F59E0B; }
.hub-invite-ico { font-size: 1.5rem; }
.hub-invite > span:nth-child(2) { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.hub-invite b { font-size: .92rem; }
.hub-invite small { font-size: .78rem; color: #92400E; }
.hub-invite-go { font-size: 1.4rem; color: #D97706; }
.inv-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.inv-link { display: flex; gap: .5rem; }
.inv-link input { flex: 1; min-width: 0; height: 2.9rem; padding: 0 .9rem; border-radius: 12px; border: 1px solid #E2E8F0; background: #F8FAF9; font: inherit; font-size: .92rem; color: #10251F; }
.inv-link .button { border-radius: 12px; flex: none; }
.inv-apps { display: flex; flex-wrap: wrap; gap: .5rem; }
.inv-apps a { padding: .45rem .9rem; border-radius: 999px; background: #F1F5F3; color: #065F46; font-size: .82rem; font-weight: 700; text-decoration: none; }
.inv-apps a:hover { background: #D1FAE5; }
.inv-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; font-size: .88rem; color: #475569; }
.inv-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inv-friends { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.inv-friends li { display: flex; align-items: center; gap: .7rem; padding: .55rem .4rem; border-bottom: 1px solid #F1F5F9; }
.inv-av { width: 2rem; height: 2rem; flex: none; display: grid; place-items: center; border-radius: 10px; background: #D1FAE5; color: #065F46; font-weight: 800; font-size: .8rem; }
.inv-name { flex: 1; min-width: 0; display: grid; }
.inv-name b { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-name small { font-size: .7rem; color: #94A3B8; }
.inv-tag { flex: none; padding: .2rem .55rem; border-radius: 999px; background: #F1F5F9; color: #64748B; font-size: .7rem; font-weight: 700; }
.inv-tag.is-paid { background: #ECFDF5; color: #047857; }
.ref-note { margin: .25rem 0 1rem; padding: .7rem .9rem; border-radius: 12px; background: #FEF3C7; color: #78350F; font-size: .9rem; font-weight: 600; }
@media (max-width: 760px) {
    .inv-grid { grid-template-columns: minmax(0, 1fr); }
    .inv-link { flex-direction: column; }
    .inv-link input { font-size: 16px; }
    .inv-link .button { width: 100%; justify-content: center; }
}
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] .hub-invite { background: var(--gold-wash); border-color: #5A3423; color: #FED7AA; }
    html[data-theme="auto"] .hub-invite small { color: #FDBA74; }
    html[data-theme="auto"] .inv-link input { background: var(--paper); border-color: var(--rule); color: var(--ink); }
    html[data-theme="auto"] .inv-apps a { background: var(--paper); color: var(--mint); }
    html[data-theme="auto"] .inv-friends li { border-color: var(--rule); }
}
/* โหมดมืดที่เลือกในหลังบ้าน */
html[data-theme="dark"] .hub-invite { background: var(--gold-wash); border-color: #5A3423; color: #FED7AA; }
    html[data-theme="dark"] .hub-invite small { color: #FDBA74; }
    html[data-theme="dark"] .inv-link input { background: var(--paper); border-color: var(--rule); color: var(--ink); }
    html[data-theme="dark"] .inv-apps a { background: var(--paper); color: var(--mint); }
    html[data-theme="dark"] .inv-friends li { border-color: var(--rule); }

