/* ===== โทเคนการออกแบบ (สีหลักตั้งค่าได้จากหลังบ้าน ผ่านตัวแปร --brand / --accent) ===== */
:root {
  --brand: #0d7a6b; --accent: #f26b3a;
  --brand-ink: color-mix(in srgb, var(--brand) 62%, #06110f);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, #fff);
  --brand-line: color-mix(in srgb, var(--brand) 24%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, #fff);
  --ink: #15211f; --ink-2: #3c4a47; --muted: #66736f; --line: #e3e6e1; --bg: #f6f5f0; --card: #fff;
  --green: #15803d; --amber: #b45309; --red: #b91c1c; --blue: #1d4ed8;
  --r: 14px; --r-sm: 9px; --shadow: 0 1px 2px rgba(20, 33, 30, .05), 0 6px 20px rgba(20, 33, 30, .06);
  --font: 'Anuphan', 'IBM Plex Sans Thai', 'Noto Sans Thai', 'Sukhumvit Set', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { flex: none; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); } .small { font-size: 14px; } .xs { font-size: 13px; } .nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .row-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 16px; } .mt { margin-top: 16px; } .mt-lg { margin-top: 28px; }
.tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ===== ปุ่ม / ป้าย ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 86%, #000); border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--red); } .btn-danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; } .btn-block { width: 100%; }
.btn-icon { width: 34px; min-height: 34px; padding: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eef0ee; color: var(--ink-2); white-space: nowrap; }
.tone-green { background: #e7f6ec; color: var(--green); } .tone-amber { background: #fdf3df; color: var(--amber); } .tone-red { background: #fdecec; color: var(--red); } .tone-blue { background: #e8effd; color: var(--blue); } .tone-gray { background: #eef0ee; color: var(--muted); }
.tone-brand { background: var(--brand-soft); color: var(--brand-ink); }
.lv { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 7px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--lv, #64748b); background: color-mix(in srgb, var(--lv, #64748b) 12%, #fff); border: 1px solid color-mix(in srgb, var(--lv, #64748b) 30%, #fff); white-space: nowrap; }
.verified { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-size: 13px; font-weight: 600; white-space: nowrap; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; } .avatar.sm { width: 28px; height: 28px; font-size: 13px; }

/* ===== ส่วนหัว ===== */
.announce { background: var(--brand-ink); color: #fff; font-size: 14px; text-align: center; padding: 7px 16px; }
.announce a { text-decoration: underline; font-weight: 600; }
.site-head { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 22px; height: 66px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 22px; letter-spacing: -.01em; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 999px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.nav a:hover, .nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.head-actions { display: flex; align-items: center; gap: 8px; }
.fav-link { position: relative; }
.fav-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: none; place-items: center; }
.fav-count.show { display: grid; }
.menu-btn { display: none; }
@media (max-width: 960px) {
  .menu-btn { display: inline-flex; margin-left: auto; }
  .site-head .wrap { gap: 10px; }
  .nav, .head-actions { display: none; }
  .site-head.open .nav, .site-head.open .head-actions { display: flex; position: absolute; left: 0; right: 0; background: #fff; padding: 10px 16px; }
  .site-head.open .nav { top: 66px; flex-direction: column; }
  .site-head.open .head-actions { top: calc(66px + var(--nav-h, 250px)); border-bottom: 1px solid var(--line); padding-bottom: 16px; flex-wrap: wrap; box-shadow: 0 16px 24px rgba(0, 0, 0, .08); }
}

/* ===== Hero + กล่องค้นหา ===== */
.hero { background: radial-gradient(1000px 420px at 85% -10%, var(--accent-soft), transparent 70%), linear-gradient(180deg, var(--brand-soft), var(--bg)); padding: 52px 0 36px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(30px, 4.4vw, 50px); letter-spacing: -.02em; line-height: 1.18; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero-lead { margin-top: 14px; font-size: 18px; color: var(--ink-2); max-width: 34em; }
.hero-art { position: relative; aspect-ratio: 1 / .86; }
.hero-art img { position: absolute; border-radius: 22px; object-fit: cover; box-shadow: var(--shadow); border: 5px solid #fff; }
.hero-art img:nth-child(1) { width: 68%; height: 74%; right: 0; top: 0; }
.hero-art img:nth-child(2) { width: 52%; height: 50%; left: 0; bottom: 0; }
.hero-chip { position: absolute; right: 6%; bottom: 7%; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; }
.hero-chip .ic { color: var(--brand); }
.searchbox { margin-top: 26px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 8px; border: 1px solid var(--line); }
.seg { display: inline-flex; background: #eef0ec; border-radius: 999px; padding: 4px; gap: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 20px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--brand-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); }
.searchbox .seg { margin: 6px 6px 8px; }
.search-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: 8px; }
.search-row > * { min-width: 0; }
.in-ic { position: relative; }
.in-ic .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.in-ic .input { padding-left: 42px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.chip:hover, .chip.on { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.stat-strip { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.stat-strip b { font-size: 24px; display: block; line-height: 1.1; }
.stat-strip span { font-size: 14px; color: var(--muted); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { display: none; } .search-row { grid-template-columns: 1fr 1fr; } .search-row .in-ic, .search-row .btn { grid-column: 1 / -1; } .hero { padding-top: 32px; } }

/* ===== ฟอร์ม ===== */
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; transition: border-color .15s, box-shadow .15s; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2366736f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-weight: 600; font-size: 14.5px; }
.field .hint { font-size: 13px; color: var(--muted); }
.req::after { content: ' *'; color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid, .form-grid.c3, .form-grid.c4 { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } }
@media (max-width: 480px) { .form-grid.one-sm { grid-template-columns: 1fr; } }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px 16px; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.pick label { position: relative; }
.pick input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pick span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; font-weight: 600; font-size: 14px; text-align: center; height: 100%; }
.pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.pick input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); }
.alert { padding: 12px 16px; border-radius: var(--r-sm); font-weight: 500; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: #e7f6ec; color: #14532d; } .alert-error { background: #fdecec; color: #7f1d1d; } .alert-info { background: var(--brand-soft); color: var(--brand-ink); } .alert-warn { background: #fdf3df; color: #78350f; }
.alert .ic { margin-top: 2px; }

/* ===== ส่วนเนื้อหา ===== */
.section { padding: 44px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -.01em; }
.section-head p { color: var(--muted); margin-top: 4px; }
.more { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.more:hover { text-decoration: underline; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card-pad { padding: 20px; }
.types { display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px; }
.type-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); text-align: center; font-weight: 700; font-size: 14.5px; transition: border-color .15s, transform .15s; }
.type-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.type-tile .tic { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.type-tile small { font-weight: 500; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .types { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .types { grid-template-columns: repeat(2, 1fr); } }

/* ===== การ์ดประกาศ ===== */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1080px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid, .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
@media (max-width: 500px) { .grid, .grid.c3 { grid-template-columns: 1fr; } }
.pcard { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pcard-img { position: relative; aspect-ratio: 4 / 3; background: #e8ece8; overflow: hidden; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.tag { padding: 2px 10px; border-radius: 7px; font-size: 13px; font-weight: 700; color: #fff; background: var(--brand); }
.tag.rent { background: var(--accent); } .tag.feat { background: #fff; color: var(--ink); display: inline-flex; gap: 4px; align-items: center; }
.tag.feat .ic { color: #d99a00; fill: #f5c542; } .tag.dark { background: rgba(20, 33, 30, .78); }
.fav-btn { position: absolute; z-index: 2; right: 10px; top: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); display: grid; place-items: center; color: var(--ink-2); }
.fav-btn:hover { color: #e11d48; } .fav-btn.on { color: #e11d48; } .fav-btn.on .ic { fill: #e11d48; }
.pcard-body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.price { font-size: 21px; font-weight: 800; letter-spacing: -.01em; color: var(--brand-ink); line-height: 1.2; }
.price small { font-size: 14px; font-weight: 600; color: var(--muted); }
.pcard-title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.pcard-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.loc { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 14px; }
.loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.specs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.specs span { display: inline-flex; align-items: center; gap: 5px; }
.specs .ic { color: var(--muted); }
.station { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 2px 9px 2px 7px; border-radius: 999px; background: #f2f3f0; align-self: flex-start; max-width: 100%; }
.station i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #888); flex: none; }
.station span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pcard-foot .name { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ic { margin: 0 auto 12px; color: var(--brand-line); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ===== รถไฟฟ้า ===== */
.line-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.line-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-weight: 700; font-size: 14.5px; }
.line-pill i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.line-pill:hover, .line-pill.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, #fff); }
.route { display: flex; flex-wrap: wrap; row-gap: 22px; padding: 6px 0; }
.stn { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; position: relative; width: 104px; padding-top: 30px; text-align: center; background: none; border: 0; font-size: 13.5px; line-height: 1.35; color: var(--ink-2); }
.stn::before { content: ''; position: absolute; left: 0; right: 0; top: 10px; height: 6px; background: var(--c); }
.stn:first-child::before { left: 50%; border-radius: 3px 0 0 3px; } .stn:last-child::before { right: 50%; }
.stn::after { content: ''; position: absolute; left: 50%; top: 2px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: #fff; border: 5px solid var(--c); transition: transform .12s; }
.stn:hover::after { transform: scale(1.15); }
.stn.on { color: var(--ink); font-weight: 700; }
.stn.on::after { background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent); }
.stn code { display: block; font: 600 11px/1.2 var(--font); color: var(--muted); }
.stn .cnt { display: inline-block; margin-top: 2px; padding: 0 7px; border-radius: 9px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--ink); font-size: 11.5px; font-weight: 700; }
.pickbar { position: sticky; bottom: 14px; z-index: 30; margin-top: 22px; background: var(--ink); color: #fff; border-radius: 18px; padding: 12px 14px 12px 20px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); }
.pickbar .names { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; opacity: .85; }
.pickbar .seg { background: rgba(255, 255, 255, .14); } .pickbar .seg span { color: #fff; padding: 5px 14px; } .pickbar .seg input:checked + span { color: var(--ink); }
@media (max-width: 640px) { .pickbar { flex-wrap: wrap; } .pickbar .names { flex-basis: 100%; } .stn { width: 25%; } }

/* ===== หน้าค้นหา ===== */
.page-head { padding: 26px 0 8px; }
.page-head h1 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.01em; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 8px; align-items: center; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.search-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 26px; align-items: start; padding: 14px 0 56px; }
.filters { position: sticky; top: 82px; padding: 18px; max-height: calc(100vh - 100px); overflow: auto; }
.filters { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
.filters::-webkit-scrollbar { display: none; }
/* ลูกศรบอกว่ามีตัวกรองต่อด้านล่าง (แทนแถบเลื่อนที่ซ่อนไว้) */
.filters-more { position: sticky; bottom: -18px; display: flex; justify-content: center; align-items: flex-end; width: calc(100% + 36px); height: 64px; margin: -46px -18px -18px; padding: 0 0 8px; border: 0; border-radius: 0 0 var(--r) var(--r); background: linear-gradient(transparent, #fff 62%); color: var(--brand-ink); }
.filters-more span { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(20, 33, 30, .12); display: grid; place-items: center; animation: nudge 1.8s ease-in-out infinite; }
.filters-more:hover span { border-color: var(--brand); background: var(--brand-soft); }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .filters-more span { animation: none; } }
.filters summary { display: none; }
.filters .stack { gap: 14px; }
.filters .seg { display: flex; } .filters .seg label { flex: 1; text-align: center; } .filters .seg span { padding: 7px 8px; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.result-bar .select { width: auto; min-height: 40px; }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 30px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 42px; height: 42px; padding: 0 12px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 600; }
.pager a:hover { border-color: var(--brand); } .pager .on { background: var(--brand); border-color: var(--brand); color: #fff; } .pager .gap { border: 0; background: none; }
@media (max-width: 900px) {
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; padding: 0; }
  .filters-more { display: none; }
  .filters summary { display: flex; align-items: center; gap: 8px; padding: 13px 16px; font-weight: 700; cursor: pointer; list-style: none; }
  .filters summary::-webkit-details-marker { display: none; }
  .filters form { padding: 4px 16px 16px; }
}

/* ===== รายละเอียดประกาศ ===== */
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: min(480px, 56vw); border-radius: 18px; overflow: hidden; position: relative; }
.gallery button { border: 0; padding: 0; background: #e8ece8; overflow: hidden; position: relative; }
.gallery button:first-child { grid-row: span 2; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery button:hover img { transform: scale(1.03); }
.gallery.n1 { grid-template-columns: 1fr; } .gallery.n2 { grid-template-columns: 1fr 1fr; } .gallery.n2 button { grid-row: span 2; }
.gallery.n3 { grid-template-columns: 2fr 1fr; }
.gallery .all { position: absolute; right: 14px; bottom: 14px; background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; box-shadow: var(--shadow); pointer-events: none; }
@media (max-width: 720px) { .gallery, .gallery.n3 { grid-template-columns: 1fr; grid-template-rows: 1fr; height: 62vw; } .gallery button:not(:first-child) { display: none; } }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 32px; align-items: start; padding: 26px 0 60px; }
.detail h1 { font-size: clamp(22px, 2.8vw, 30px); }
.detail .price { font-size: 32px; }
.detail-block { padding: 24px 0; border-top: 1px solid var(--line); }
.detail-block h2 { font-size: 20px; margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-top: 20px; }
.fact { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.fact .ic { color: var(--brand); margin-bottom: 6px; }
.fact b { display: block; font-size: 17px; line-height: 1.3; } .fact span { font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, 1fr); } }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.kv dt, .kv span:first-child { color: var(--muted); } .kv span:last-child { font-weight: 600; text-align: right; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } }
.amen { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; }
.amen span { display: flex; align-items: center; gap: 8px; } .amen .ic { color: var(--brand); }
.map { width: 100%; height: 320px; border: 0; border-radius: var(--r); background: #e8ece8; }
.side { position: sticky; top: 86px; display: grid; gap: 16px; }
.agent-card .top { display: flex; gap: 14px; align-items: center; }
.agent-card .name { font-weight: 700; font-size: 18px; line-height: 1.3; }
.contact-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.btn-line { background: #06c755; border-color: #06c755; color: #fff; } .btn-line:hover { background: #05b04b; border-color: #05b04b; }
.mobile-cta { display: none; }
@media (max-width: 960px) {
  .detail { grid-template-columns: 1fr; } .side { position: static; }
  .mobile-cta { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .mobile-cta .btn { flex: 1; } body.has-cta { padding-bottom: 76px; }
}
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 14, 13, .94); display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1100px, 94vw); max-height: 84vh; border-radius: 10px; }
.lightbox button { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; }
.lightbox button:hover { background: rgba(255, 255, 255, .28); }
.lb-close { top: 18px; right: 18px; } .lb-prev { left: 18px; } .lb-next { right: 18px; }
.lb-count { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }

/* ===== นายหน้า / บทความ / แพ็กเกจ ===== */
.agent-tile { padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; transition: box-shadow .2s, transform .2s; }
.agent-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.agent-tile h3 { font-size: 17px; } .agent-tile h3 a::after { content: ''; position: absolute; inset: 0; }
.agent-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
.agent-stats b { display: block; font-size: 18px; line-height: 1.2; } .agent-stats span { font-size: 12.5px; color: var(--muted); }
.profile-head { display: flex; gap: 22px; align-items: center; padding: 26px; flex-wrap: wrap; }
.acard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; position: relative; transition: box-shadow .2s, transform .2s; }
.acard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.acard img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; background: #e8ece8; }
.acard-body { padding: 16px 18px 18px; display: grid; gap: 8px; }
.acard h3 { font-size: 18px; line-height: 1.4; } .acard h3 a::after { content: ''; position: absolute; inset: 0; }
.acard p { color: var(--muted); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #a16207; } .rating .ic { fill: #f5c542; color: #d99a00; }
.article { max-width: 760px; margin-inline: auto; padding: 30px 0 60px; }
.article h1 { font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.015em; margin: 10px 0 14px; }
.article .cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; margin: 22px 0; background: #e8ece8; }
.prose { font-size: 17.5px; line-height: 1.85; color: var(--ink-2); }
.prose h2 { font-size: 24px; margin: 34px 0 10px; color: var(--ink); } .prose h3 { font-size: 20px; margin: 26px 0 8px; color: var(--ink); }
.prose p { margin: 0 0 16px; } .prose ul { margin: 0 0 16px; padding-left: 24px; } .prose li { margin-bottom: 6px; }
.prose a { color: var(--brand); text-decoration: underline; } .prose img { border-radius: 12px; margin: 16px 0; }
.prose blockquote { margin: 20px 0; padding: 14px 18px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 12px 12px 0; color: var(--brand-ink); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; align-items: stretch; }
.plan { padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.plan.pop { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.plan .pop-tag { position: absolute; top: -13px; left: 24px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; padding: 2px 12px; border-radius: 999px; }
.plan h3 { font-size: 20px; } .plan .amt { font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; } .plan .amt small { font-size: 15px; font-weight: 600; color: var(--muted); }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; align-content: start; } .plan li { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; } .plan li .ic { color: var(--brand); margin-top: 3px; }
.plan.current { background: var(--brand-soft); }
.level-ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.level-step { padding: 16px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--lv); }
.level-step b { font-size: 17px; color: var(--lv); display: flex; gap: 6px; align-items: center; } .level-step .pts { font-weight: 700; font-size: 14px; margin: 2px 0 4px; } .level-step p { font-size: 13.5px; color: var(--muted); }
.cta-band { background: var(--brand-ink); color: #fff; border-radius: 24px; padding: 38px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; background-image: radial-gradient(500px 240px at 90% 0%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%); }
/* ปุ่มรองบนแถบสีเข้ม: ขอบขาว ตัวอักษรขาว (เดิมตัวอักษรขาวบนพื้นขาวจึงมองไม่เห็น) */
.cta-band .btn:not(.btn-accent) { background: transparent; border-color: rgba(255, 255, 255, .75); color: #fff; }
.cta-band .btn:not(.btn-accent):hover { background: #fff; border-color: #fff; color: var(--brand-ink); }
/* ===== หน้าต่างยืนยันของเว็บ (แทนกล่องยืนยันของเบราว์เซอร์) ===== */
.cdialog { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(8, 14, 13, .55); opacity: 0; transition: opacity .18s; }
.cdialog.open { opacity: 1; }
.cdialog-box { width: min(440px, 100%); background: #fff; border-radius: 20px; padding: 28px 26px 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); text-align: center; transform: translateY(10px) scale(.98); transition: transform .18s; }
.cdialog.open .cdialog-box { transform: none; }
.cdialog-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 800; background: var(--brand-soft); color: var(--brand); }
.cdialog-icon.danger { background: #fdecec; color: var(--red); }
.cdialog-box h2 { font-size: 21px; margin-bottom: 8px; }
.cdialog-box p { color: var(--ink-2); line-height: 1.65; }
.cdialog-box .field { text-align: left; margin-top: 14px; }
.cdialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #991b1b; border-color: #991b1b; }
@media (max-width: 420px) { .cdialog-actions { grid-template-columns: 1fr; } .cdialog-actions [data-cd-ok] { order: -1; } }
@media (prefers-reduced-motion: reduce) { .cdialog, .cdialog-box { transition: none; } }

/* ===== หน้าชำระเงินด้วยบัตร ===== */
.pay-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; max-width: 900px; }
.pay-layout .form-card + .form-card { margin-top: 0; }
.pay-layout h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.pay-element { min-height: 150px; }
.pay-summary { background: var(--brand-soft); border-color: var(--brand-line); }
.pay-total { border-top: 1px solid var(--brand-line); padding-top: 14px; }
.pay-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14.5px; }
.pay-notes li { display: flex; gap: 8px; align-items: flex-start; } .pay-notes .ic { color: var(--brand); margin-top: 3px; }
@media (max-width: 860px) { .pay-layout { grid-template-columns: 1fr; } .pay-summary { order: -1; } }

/* ===== Popup หน้าเว็บ ===== */
.popup { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(8, 14, 13, .62); opacity: 0; transition: opacity .25s; }
.popup.open { opacity: 1; }
.popup-box { position: relative; width: min(520px, 100%); max-height: calc(100vh - 40px); border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); transform: translateY(14px) scale(.98); transition: transform .25s; }
.popup.open .popup-box { transform: none; }
.popup-close { position: absolute; z-index: 3; right: 10px; top: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .94); color: var(--ink); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.popup-close:hover { background: #fff; color: var(--red); }
.popup-preview-tag { position: absolute; z-index: 3; left: 10px; top: 10px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.popup-image { background: transparent; box-shadow: none; overflow: visible; width: min(480px, 100%); }
.popup-image a { display: block; }
.popup-image img { display: block; width: 100%; height: auto; max-height: calc(100vh - 60px); object-fit: contain; border-radius: 18px; filter: drop-shadow(0 18px 36px rgba(0, 0, 0, .4)); }
.popup-text { display: grid; }
.popup-text > * { grid-area: 1 / 1; }
.popup-bg { width: 100%; height: 100%; object-fit: cover; min-height: 320px; }
.popup-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 10px; padding: 52px 30px 30px; min-height: 240px; overflow: auto; }
.popup-content h2 { font-size: clamp(22px, 4.6vw, 30px); line-height: 1.25; letter-spacing: -.01em; padding-right: 30px; }
.popup-content p { font-size: 16.5px; line-height: 1.65; }
.popup-content .btn { margin-top: 8px; }
.popup-text.no-bg .popup-content { justify-content: center; color: var(--ink); border-top: 6px solid var(--brand); }
.popup-text.no-bg .popup-content p { color: var(--ink-2); }
.popup-text.has-bg .popup-content { min-height: 380px; }
.popup-text.theme-light .popup-content { color: #fff; background: linear-gradient(0deg, rgba(8, 14, 13, .82), rgba(8, 14, 13, .35) 60%, rgba(8, 14, 13, .1)); }
.popup-text.theme-dark .popup-content { color: var(--ink); background: linear-gradient(0deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .6) 60%, rgba(255, 255, 255, .15)); }
@media (prefers-reduced-motion: reduce) { .popup, .popup-box { transition: none; } }

/* ช่องรหัสผ่านพร้อมปุ่มแสดง/ซ่อน */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 50px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--brand); background: var(--brand-soft); }
.input.bad { border-color: #f87171; }

/* ภาพโลโก้ที่อัปโหลดจากหลังบ้าน */
.logo-img { height: 40px; width: auto; max-width: 210px; object-fit: contain; }
.logo-preview { display: grid; place-items: center; min-height: 92px; padding: 16px; border-radius: var(--r-sm); border: 1px dashed var(--brand-line); background: #fff; }
.logo-preview.dark { background: #101b19; border-color: transparent; color: #c6d0cd; }
.logo-preview img { max-height: 56px; max-width: 100%; object-fit: contain; }
@media (max-width: 500px) { .logo-img { height: 34px; max-width: 150px; } }
.cta-band h2 { font-size: clamp(22px, 2.8vw, 30px); } .cta-band p { opacity: .86; max-width: 36em; margin-top: 6px; }
.auth { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 36px 16px; }
.auth-card { width: min(460px, 100%); padding: 30px; }
.auth-card h1 { font-size: 26px; }
.demo-box { background: var(--brand-soft); border: 1px dashed var(--brand-line); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; }
.demo-box button { border: 0; background: none; color: var(--brand); font-weight: 700; padding: 0; text-decoration: underline; }

/* ===== ส่วนท้าย ===== */
.site-foot { background: #101b19; color: #c6d0cd; margin-top: 30px; padding: 46px 0 22px; font-size: 15px; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 32px; }
.site-foot h4 { color: #fff; font-size: 15px; margin-bottom: 12px; } .site-foot a:hover { color: #fff; text-decoration: underline; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; } .site-foot .logo { color: #fff; margin-bottom: 12px; }
.foot-bottom { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 32px; padding-top: 18px; font-size: 13.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.foot-contact li { display: flex; gap: 8px; align-items: flex-start; } .foot-contact .ic { margin-top: 4px; }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .foot-grid { grid-template-columns: 1fr; } }

/* ===== หลังบ้าน (นายหน้า + Super Admin) ===== */
.dash { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.dash-side { background: #101b19; color: #c6d0cd; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.dash-side .logo { color: #fff; padding: 4px 8px 14px; font-size: 20px; }
.dash-side .role { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7f8f8b; padding: 12px 10px 4px; }
.dash-side a.item, .dash-side button.item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; font-weight: 600; color: inherit; border: 0; background: none; width: 100%; text-align: left; }
.dash-side .item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.dash-side .item.on { background: var(--brand); color: #fff; }
.dash-side .item .n { margin-left: auto; background: var(--accent); color: #fff; font-size: 12px; min-width: 21px; height: 21px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.dash-side .spacer { flex: 1; min-height: 12px; }
.quota-box { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 12px; font-size: 13.5px; margin: 8px 0; }
.quota-box b { color: #fff; }
.bar { height: 7px; border-radius: 4px; background: rgba(120, 140, 135, .22); overflow: hidden; margin: 7px 0 5px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); } .bar.warn i { background: var(--accent); }
.dash-main { padding: 24px clamp(16px, 3vw, 36px) 60px; min-width: 0; }
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-top h1 { font-size: 26px; letter-spacing: -.01em; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { padding: 18px; display: flex; gap: 14px; align-items: center; }
.kpi .kic { width: 46px; height: 46px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.kpi b { font-size: 26px; line-height: 1.15; display: block; letter-spacing: -.01em; } .kpi span { font-size: 14px; color: var(--muted); }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .cols-2 { grid-template-columns: 1fr; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafaf7; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; background: #e8ece8; flex: none; }
.cell-main { display: flex; gap: 12px; align-items: center; min-width: 250px; }
.cell-main b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; font-weight: 600; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.actions form { display: inline-flex; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); border: 1px solid transparent; }
.tabs a:hover { background: #fff; border-color: var(--line); } .tabs a.on { background: var(--ink); color: #fff; }
.tabs a small { opacity: .7; margin-left: 3px; }
.form-card { padding: 22px; } .form-card + .form-card { margin-top: 16px; }
.form-card h2 { font-size: 18px; margin-bottom: 4px; } .form-card > p.muted { margin-bottom: 16px; font-size: 14.5px; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 22px 0 14px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; z-index: 5; }
.img-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.img-item { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #e8ece8; border: 1px solid var(--line); }
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-item button { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.img-item .cov { position: absolute; left: 5px; bottom: 5px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; }
.drop { border: 2px dashed var(--brand-line); border-radius: var(--r); padding: 26px 16px; text-align: center; background: var(--brand-soft); cursor: pointer; display: block; }
.drop:hover { border-color: var(--brand); } .drop input { position: absolute; width: 1px; height: 1px; opacity: 0; } .drop .ic { margin: 0 auto 8px; color: var(--brand); }
.lead { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.lead:last-child { border-bottom: 0; } .lead.new { background: color-mix(in srgb, var(--accent) 5%, #fff); }
.lead p { color: var(--ink-2); margin-top: 3px; }
.level-card { padding: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--lv) 13%, #fff), #fff 70%); border: 1px solid color-mix(in srgb, var(--lv) 30%, #fff); border-radius: var(--r); }
.level-card .big { font-size: 26px; font-weight: 800; color: var(--lv); display: flex; align-items: center; gap: 8px; }
.level-card .bar i { background: var(--lv); }
.pt-list { display: grid; gap: 6px; margin-top: 12px; font-size: 14px; }
.pt-list div { display: flex; justify-content: space-between; gap: 10px; } .pt-list span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: 14px; padding: 5px 0; }
.hbar .track { height: 10px; background: #eef0ec; border-radius: 5px; overflow: hidden; } .hbar .track i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input, .inline-form .select { width: auto; min-height: 38px; padding-block: 6px; }
.color-in { width: 52px; min-height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 10px; gap: 2px; }
  .dash-side .logo { padding: 0 8px 0 4px; } .dash-side .logo .logo-img { height: 30px; max-width: 120px; } .dash-side .logo .logo-name, .dash-side .role, .dash-side .quota-box, .dash-side .spacer { display: none; }
  .dash-side .item { width: auto; white-space: nowrap; padding: 8px 12px; font-size: 14px; } .dash-side form { display: flex; }
}

/* ===== ตัวเขียนบทความ (หลังบ้าน) ===== */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.editor-layout .form-card + .form-card { margin-top: 0; }
.editor-layout .form-card h2 { margin: 0; }
@media (max-width: 1180px) { .editor-layout { grid-template-columns: 1fr; } }
.md { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 14px; align-items: start; }
@media (max-width: 1400px) { .md { grid-template-columns: 1fr; } }
.md-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; background: #fafaf7; }
.md-bar > button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 7px; background: none; font-size: 13.5px; font-weight: 600; }
.md-bar > button:hover { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.md-bar > button:disabled { opacity: .4; pointer-events: none; }
.md-bar > button b { font-weight: 800; color: var(--brand); }
.md-status { font-size: 13px; color: var(--muted); padding: 0 8px; }
.md-mode { margin-left: auto; display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.md-mode button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 0; border-radius: 6px; background: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.md-mode button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.md-text { border-radius: 0 0 var(--r-sm) var(--r-sm); font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace, var(--font); font-size: 14.5px; line-height: 1.7; min-height: 480px; }
.md-text.dragging { border-color: var(--brand); background: var(--brand-soft); }
.md-preview { border: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); background: #fff; padding: 22px clamp(16px, 4vw, 36px); min-height: 480px; }
.md-side { background: #fafaf7; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; position: sticky; top: 14px; display: grid; gap: 6px; }
.md-toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.md-toc button { width: 100%; text-align: left; border: 0; background: none; padding: 4px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; line-height: 1.4; }
.md-toc button.sub { padding-left: 20px; font-weight: 400; color: var(--muted); }
.md-toc button:hover { background: #fff; }
.md-alts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.md-alts li { display: flex; gap: 8px; align-items: center; }
.md-alts img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.md-alts .input { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.md-alts .input.missing { border-color: #f87171; }
.adv { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.adv summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
.serp { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; overflow: hidden; }
.serp p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-url { font-size: 12.5px; color: var(--muted); }
.serp-title { font-size: 17px; line-height: 1.35; color: #1a0dab; }
.serp .serp-desc { font-size: 13px; line-height: 1.45; color: var(--ink-2); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.seo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.seo-list li { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.seo-list b { font-weight: 600; display: block; } .seo-list small { color: var(--muted); font-size: 12.5px; }
.seo-mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; margin-top: 1px; }
.seo-mark.pass { background: var(--green); } .seo-mark.warn { background: #d97706; } .seo-mark.fail { background: var(--red); } .seo-mark.skip { background: #a8b0ad; }

/* ===== หน้าบทความ: สารบัญ + วิดีโอ ===== */
.article-wrap.has-toc { display: grid; grid-template-columns: 230px minmax(0, 760px); gap: 48px; justify-content: center; }
.article-wrap.has-toc .article { margin: 0; max-width: none; }
.toc-side { padding-top: 34px; }
.toc-side nav { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; }
.toc-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.toc { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; margin-left: -1px; padding: 6px 0 6px 16px; border-left: 2px solid transparent; font-size: 14.5px; line-height: 1.4; color: var(--muted); }
.toc a.sub { padding-left: 28px; font-size: 13.5px; }
.toc a:hover { color: var(--ink); border-color: #b8c0bc; }
.toc a.on { color: var(--ink); font-weight: 700; border-color: var(--brand); }
.toc-inline { display: none; border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 12px 16px; margin: 0 0 22px; }
.toc-inline summary { cursor: pointer; font-weight: 700; }
.toc-inline .toc { margin-top: 10px; }
@media (max-width: 1000px) { .article-wrap.has-toc { display: block; } .article-wrap.has-toc .article { max-width: 760px; margin-inline: auto; } .toc-side { display: none; } .toc-inline { display: block; } }
.prose h2, .prose h3 { scroll-margin-top: 90px; }
/* ตารางในเนื้อหา Markdown: เลื่อนแนวนอนได้บนจอแคบ */
.prose .table-scroll { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.55; }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--brand-soft); color: var(--ink); font-weight: 700; white-space: nowrap; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) td { background: #fafaf7; }
.prose ol { margin: 0 0 16px; padding-left: 24px; } .prose hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.prose .video { aspect-ratio: 16 / 9; margin: 22px 0; } .prose .video iframe { width: 100%; height: 100%; border: 0; border-radius: 14px; }
.editor-layout > *, .editor-side > *, .md > * { min-width: 0; }

/* ===== สไลด์โปรโมทโครงการ (หน้าแรก) ===== */
.promo-section { padding: 8px 0 0; }
.promo { position: relative; border-radius: 22px; overflow: hidden; background: #e8ece8; box-shadow: var(--shadow); }
.promo-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.promo-track::-webkit-scrollbar { display: none; }
.promo-slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 3 / 1; display: block; }
.promo-slide picture { display: contents; }
.promo-slide img { width: 100%; height: 100%; object-fit: cover; }
.promo-text { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 8px; padding: 0 clamp(20px, 6vw, 72px); color: #fff; background: linear-gradient(90deg, rgba(8, 18, 16, .62), rgba(8, 18, 16, .22) 55%, transparent 80%); }
.promo-title { font-size: clamp(20px, 3.2vw, 40px); font-weight: 800; line-height: 1.2; letter-spacing: -.01em; max-width: 16em; text-wrap: balance; }
.promo-sub { font-size: clamp(14px, 1.5vw, 18px); max-width: 30em; opacity: .94; }
.promo-btn { margin-top: 6px; }
.promo-ad { position: absolute; right: 12px; top: 12px; padding: 1px 9px; border-radius: 6px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 12px; font-weight: 600; }
.promo-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--ink); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.promo-nav:hover { background: #fff; } .promo-nav.prev { left: 14px; } .promo-nav.next { right: 14px; }
.promo-dots { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; }
.promo-dots button { width: 24px; height: 24px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
.promo-dots button::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .6); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); transition: width .2s, background .2s; }
.promo-dots button[aria-current="true"]::before { width: 22px; background: #fff; }
@media (max-width: 700px) { .promo { border-radius: 16px; } .promo-slide { aspect-ratio: 16 / 9; } .promo-nav { display: none; } .promo-text { background: linear-gradient(0deg, rgba(8, 18, 16, .7), rgba(8, 18, 16, .15) 70%); justify-content: flex-end; padding-bottom: 34px; } }
@media (prefers-reduced-motion: reduce) { .promo-track { scroll-behavior: auto; } }
.promo-preview { aspect-ratio: 3 / 1; border-radius: var(--r); overflow: hidden; background: #eef0ec; border: 1px dashed var(--brand-line); display: grid; place-items: center; }
.promo-preview img { width: 100%; height: 100%; object-fit: cover; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ===== โฆษณาในหน้าบทความ (ใต้เนื้อหา) ===== */
.article-ad { margin: 36px 0 0; padding-top: 28px; border-top: 1px solid var(--line); }
.article-ad-box { position: relative; display: block; aspect-ratio: 4 / 1; border-radius: var(--r); overflow: hidden; background: #e8ece8; }
.article-ad-box img { width: 100%; height: 100%; object-fit: cover; }
.article-ad .promo-text { padding: 0 clamp(16px, 4vw, 36px); gap: 4px; }
.article-ad .promo-title { font-size: clamp(17px, 2.4vw, 26px); }
.article-ad .promo-sub { font-size: 14.5px; }
@media (max-width: 700px) { .article-ad-box { aspect-ratio: 2 / 1; } .article-ad .promo-text { padding-bottom: 14px; } }

/* ===== ภาพ Mockup ของระบบ (ประกาศที่ยังไม่มีรูปจริง) ===== */
.mock-note { background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; }
.mock-note .ic { color: var(--brand); margin-top: 2px; }
.mock-note.off { opacity: .55; }
.mock-tag { position: absolute; left: 14px; bottom: 14px; background: rgba(20, 33, 30, .72); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; pointer-events: none; }
