/* คาถาไทย — ธีมมืดแบบแอป AI สมัยใหม่ + กลิ่นไอไทยร่วมสมัย
   หยก (jade) เรืองแสง + ทองไทย + ลายประจำยามจาง ๆ */
:root {
  --bg: #07090a; --bg2: #0c1110; --card: rgba(255,255,255,.035); --card-solid: #111816; --ink: #eef3f1; --muted: #93a39d;
  --line: rgba(255,255,255,.09); --line2: rgba(255,255,255,.16);
  --brand: #2fe0a0; --brand2: #16b8c8; --gold: #e8b64c; --gold2: #f6d98b; --brand-ink: #04140e; --brand-soft: rgba(47,224,160,.12);
  --ok: #43d98f; --ok-soft: rgba(67,217,143,.12); --warn: #f0b24a; --warn-soft: rgba(240,178,74,.12);
  --bad: #ff7a6b; --bad-soft: rgba(255,122,107,.12);
  --radius: 18px; --shadow: 0 10px 40px rgba(0,0,0,.35);
  --grad: linear-gradient(135deg, var(--brand), var(--brand2));
  --grad-gold: linear-gradient(120deg, var(--gold2), var(--gold) 45%, var(--brand) 100%);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23e8b64c' stroke-opacity='.07' stroke-width='1'%3E%3Cpath d='M48 30c6 8 6 12 0 18-6-6-6-10 0-18zM48 66c-6-8-6-12 0-18 6 6 6 10 0 18zM30 48c8-6 12-6 18 0-6 6-10 6-18 0zM66 48c-8 6-12 6-18 0 6-6 10-6 18 0z'/%3E%3Cpath d='M48 42l6 6-6 6-6-6z'/%3E%3Cpath d='M0 0l8 8M96 0l-8 8M0 96l8-8M96 96l-8-8'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh;
  font: 16px/1.65 "Anuphan", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; z-index: -2; background-image: var(--pattern); background-size: 96px; pointer-events: none;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%); }
.glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.glow::before, .glow::after { content: ""; position: absolute; border-radius: 50%; filter: blur(90px); }
.glow::before { width: 900px; height: 520px; left: 50%; top: -260px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(47,224,160,.30), rgba(22,184,200,.12) 60%, transparent); }
.glow::after { width: 520px; height: 420px; right: -160px; top: 40%; background: radial-gradient(closest-side, rgba(232,182,76,.10), transparent); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(47,224,160,.3); }

/* ------------------------------------------------ โลโก้ */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 20px; color: var(--ink); letter-spacing: .2px; }
.logo:hover { text-decoration: none; }
.logo svg { width: 28px; height: 28px; filter: drop-shadow(0 0 10px rgba(232,182,76,.35)); }
.logo .tag { font-size: 11px; font-weight: 600; color: var(--gold); border: 1px solid rgba(232,182,76,.4); border-radius: 999px; padding: 0 7px; line-height: 18px; }

/* ------------------------------------------------ เว็บไซต์ (หน้าแรก/สมัคร/เข้าสู่ระบบ) */
.promo { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 8px 16px; font-size: 14px;
  background: linear-gradient(90deg, rgba(232,182,76,.10), rgba(47,224,160,.10)); border-bottom: 1px solid var(--line); color: var(--ink); text-align: center; }
.promo a { background: var(--ink); color: #07110d; border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: 13px; }
.promo a:hover { text-decoration: none; opacity: .9; }
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 12px 20px; max-width: 1200px; margin: 0 auto;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
header.top .logo { margin-right: 18px; }
header.top .links { display: flex; gap: 2px; margin-right: auto; }
header.top .links a { color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: 15px; }
header.top .links a:hover { color: var(--ink); background: var(--card); text-decoration: none; }
header.top .spacer { margin-right: auto; }
header.top form { margin: 0; }

/* ------------------------------------------------ แอป (หลังเข้าสู่ระบบ) */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: rgba(10,14,13,.72); border-right: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.side .logo { padding: 4px 8px 14px; }
.side .new { display: flex; justify-content: center; gap: 8px; padding: 11px; border-radius: 14px; background: #f4f7f5; color: #07110d; font-weight: 700; margin-bottom: 10px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 8px 30px rgba(47,224,160,.15); }
.side .new:hover { text-decoration: none; background: #fff; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; color: var(--muted); font-size: 15.5px; }
.side nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.side nav a:hover { background: var(--card); color: var(--ink); text-decoration: none; }
.side nav a.on { background: linear-gradient(90deg, rgba(47,224,160,.16), rgba(47,224,160,.03)); color: var(--ink); box-shadow: inset 2px 0 0 var(--brand); }
.side nav a.on svg { color: var(--brand); opacity: 1; }
.side nav .count { margin-left: auto; background: var(--gold); color: #1b1203; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 7px; }
.side .label { font-size: 12px; letter-spacing: 1.5px; color: #66756f; padding: 14px 12px 4px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.credit-box { display: block; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(232,182,76,.28);
  background: linear-gradient(135deg, rgba(232,182,76,.12), rgba(47,224,160,.06)); color: var(--ink); }
.credit-box:hover { text-decoration: none; border-color: rgba(232,182,76,.55); }
.credit-box small { display: block; color: var(--muted); font-size: 12.5px; }
.credit-box b { font-size: 22px; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.credit-box span { font-size: 12.5px; color: var(--gold); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.me .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #07110d; background: var(--grad-gold); flex: none; }
.me .who { min-width: 0; flex: 1; line-height: 1.25; }
.me .who b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me form { margin: 0; }
.me button { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 5px 8px; cursor: pointer; display: grid; place-items: center; }
.me button:hover { color: var(--ink); border-color: var(--line2); }
.me button svg { width: 16px; height: 16px; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-main .wrap { width: 100%; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side, .side nav { min-width: 0; max-width: 100vw; }
  .side { position: sticky; z-index: 30; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo { padding: 0; margin-right: auto; font-size: 18px; }
  .side .new { order: 2; padding: 7px 14px; margin: 0; font-size: 14.5px; border-radius: 999px; }
  .side nav { order: 4; flex-direction: row; width: 100%; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; font-size: 14.5px; }
  .side nav a.on { box-shadow: inset 0 0 0 1px rgba(47,224,160,.4); }
  .side nav a svg { width: 16px; height: 16px; }
  .side .label { display: none; }
  .side-foot { order: 3; margin: 0; flex-direction: row; align-items: center; gap: 6px; }
  .credit-box { padding: 4px 12px; border-radius: 999px; }
  .credit-box small, .credit-box span { display: none; }
  .credit-box b { font-size: 15px; }
  .me .who { display: none; }
  .me { padding: 0; }
  .me .av { width: 30px; height: 30px; font-size: 14px; }
}

/* ------------------------------------------------ เนื้อหา */
.wrap { max-width: 920px; margin: 0 auto; padding: 8px 20px 64px; }
h1 { font-size: clamp(26px, 3.4vw, 32px); margin: 22px 0 6px; line-height: 1.25; letter-spacing: -.2px; }
h2 { font-size: 19px; margin: 0 0 10px; }
p.lead { color: var(--muted); margin: 0 0 20px; font-size: 16.5px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 14px 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid .card { margin: 0; }
label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: 15px; }
.hint { color: var(--muted); font-size: 13.5px; font-weight: 400; margin: 2px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select, input[type=file] {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit;
  background: rgba(0,0,0,.35); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2393a39d' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
select option { background: #111816; }
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #61716b; }
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(47,224,160,.6); box-shadow: 0 0 0 4px rgba(47,224,160,.12); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 17px; height: 17px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 20px;
  border-radius: 999px; border: 1px solid var(--line2); background: rgba(255,255,255,.04); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .2s, background .2s; }
.btn:hover { text-decoration: none; background: rgba(255,255,255,.08); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--brand-ink);
  box-shadow: 0 0 0 1px rgba(47,224,160,.4), 0 8px 28px rgba(47,224,160,.28); }
.btn.primary:hover { box-shadow: 0 0 0 1px rgba(47,224,160,.6), 0 10px 36px rgba(47,224,160,.42); }
.btn.gold { background: var(--grad-gold); border-color: transparent; color: #1b1203; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #04140e; }
.btn.small { padding: 6px 14px; font-size: 14px; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 6px 10px; font-weight: 500; }
.btn.link:hover { color: var(--ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(67,217,143,.25); padding: 11px 15px; border-radius: 12px; margin: 14px 0; }
.error, .flash.error { background: var(--bad-soft); color: var(--bad); border: 1px solid rgba(255,122,107,.25); padding: 11px 15px; border-radius: 12px; margin: 14px 0; }
.note { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(240,178,74,.25); padding: 11px 15px; border-radius: 12px; margin: 14px 0; font-size: 15px; }
.badge { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.07); color: var(--muted); white-space: nowrap; }
.badge.review { background: var(--ok-soft); color: var(--ok); }
.badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.failed, .badge.rejected { background: var(--bad-soft); color: var(--bad); }
.badge.running, .badge.queued { background: var(--brand-soft); color: var(--brand); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .title a { color: var(--ink); }
.list .meta { color: var(--muted); font-size: 13.5px; }
.steps { list-style: none; padding: 0; margin: 0; position: relative; }
.steps li { display: flex; gap: 14px; align-items: center; padding: 9px 0; color: var(--muted); position: relative; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 38px; bottom: -8px; width: 2px; background: var(--line2); }
.steps li.done:not(:last-child)::after { background: var(--ok); }
.steps li .num { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.08); color: var(--muted); position: relative; z-index: 1; }
.steps li .lbl { flex: 1; }
.steps li .state { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.05); color: var(--muted); white-space: nowrap; }
.steps li.done { color: var(--ink); }
.steps li.done .num { background: var(--ok); color: #04140e; }
.steps li.done .state { background: rgba(47,224,160,.14); color: var(--ok); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now .num { background: var(--brand); color: #04140e; }
.steps li.now .num::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent;
  border-top-color: var(--brand); border-right-color: var(--brand); animation: spin 1s linear infinite; }
.steps li.now .state { background: rgba(232,182,76,.16); color: #e8b64c; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(47,224,160,.15); } }
pre.log { background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 12.5px; white-space: pre-wrap; color: var(--muted); margin: 10px 0 0; max-height: 170px; overflow: auto; }
.video { display: grid; gap: 18px; grid-template-columns: minmax(0, 300px) 1fr; align-items: start; }
.video video { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 9/16; box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0,0,0,.5); }
@media (max-width: 640px) { .video { grid-template-columns: 1fr; } .video video { max-width: 320px; margin: 0 auto; display: block; } }
.scene { padding: 9px 0; border-top: 1px dashed var(--line); font-size: 15px; }
.scene .who { color: var(--muted); font-size: 13px; }
.stat { font-size: 30px; font-weight: 700; letter-spacing: -.3px; }
.muted { color: var(--muted); }
.tpl-card h2 { margin-bottom: 4px; }
.sugg button { display: block; width: 100%; text-align: left; margin: 7px 0; font-weight: 500; border-radius: 14px; padding: 10px 14px; }
.auth { max-width: 440px; margin: 40px auto; }
.auth h1 { margin-top: 0; }
footer.foot { text-align: center; color: #66756f; font-size: 13px; padding: 28px 16px; }
footer.foot a { color: var(--muted); }
table { border-collapse: collapse; }

/* หัวข้อมีเส้นลายไทย */
.orn { display: flex; align-items: center; gap: 12px; justify-content: center; color: var(--gold); }
.orn::before, .orn::after { content: ""; height: 1px; width: 60px; background: linear-gradient(90deg, transparent, rgba(232,182,76,.6)); }
.orn::after { transform: scaleX(-1); }
.orn svg { width: 16px; height: 16px; }
.gold-text { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ทำคลิปใหม่ แบบกล่องสั่งงาน */
.create-head { text-align: center; padding: 26px 0 6px; }
.create-head h1 { font-size: clamp(28px, 4.4vw, 40px); margin: 10px 0 6px; }
.prompt-card { border-radius: 22px; padding: 22px; background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0,0,0,.45), 0 0 120px rgba(47,224,160,.06); }
.prompt-card #topic { font-size: 18px; padding: 15px 16px; border-radius: 14px; }

/* โอนเงิน + สลิป */
.pay-amount { font-size: 44px; font-weight: 800; text-align: center; margin: 6px 0 12px; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pay-steps { padding-left: 20px; margin: 0 0 12px; }
.qr { text-align: center; margin: 8px 0 14px; }
.qr svg { width: 240px; max-width: 80%; height: auto; background: #fff; border-radius: 14px; padding: 6px; }
.bank { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; line-height: 1.9; background: rgba(0,0,0,.25); }
.bank .muted { display: inline-block; min-width: 86px; }
form.resend { margin-top: 10px; opacity: .85; }
.order.review { border-left: 3px solid var(--gold); }
.slip { max-width: 220px; max-height: 320px; border-radius: 10px; border: 1px solid var(--line); margin: 8px 0; display: block; }

/* ระดับคุณภาพบท */
.tiers { display: grid; gap: 8px; margin-bottom: 6px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tier { display: flex; gap: 8px; align-items: baseline; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; margin: 0;
  background: rgba(0,0,0,.2); transition: border-color .15s, background .15s; }
.tier:hover { border-color: var(--line2); }
.tier:has(input:checked) { border-color: rgba(47,224,160,.6); background: rgba(47,224,160,.07); box-shadow: 0 0 0 3px rgba(47,224,160,.08); }
.tier .hint { flex-basis: 100%; margin-left: 25px; }
.tier.off { opacity: .45; cursor: not-allowed; }
.prompt-card .opts { display: grid; gap: 0 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .prompt-card .opts { grid-template-columns: 1fr; } }
.go-row { display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.go-row #est { margin: 0 auto 0 0; }

/* เลือกรูปแบบคลิป + ความยาว */
.styles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 14px; }
.style { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 12px; cursor: pointer; margin: 0; position: relative; }
.style input { position: absolute; opacity: 0; pointer-events: none; }
.style:hover { border-color: var(--line2); }
.style:has(input:checked) { border-color: rgba(47,224,160,.7); background: rgba(47,224,160,.07); box-shadow: 0 0 0 3px rgba(47,224,160,.1); }
.style .thumb { position: relative; aspect-ratio: 9 / 16; max-height: 260px; border-radius: 11px; overflow: hidden; background: #0d1014; margin-bottom: 4px; }
.style video { width: 100%; height: 100%; object-fit: cover; display: block; }
.style .nothumb { display: grid; place-items: center; height: 100%; text-align: center; color: var(--muted); font-size: 14px; }
.style b { font-size: 15px; }
.style .hint { font-size: 12.5px; line-height: 1.45; }
.style .price { color: var(--gold); font-size: 13.5px; font-weight: 600; margin-top: auto; }
.style.soon { cursor: not-allowed; }
.style.soon .thumb { opacity: .8; }
.soon-badge { position: absolute; top: 8px; left: 8px; background: var(--gold); color: #1b1407; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.durs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.dur { margin: 0; cursor: pointer; position: relative; }
.dur input { position: absolute; opacity: 0; pointer-events: none; }
.dur span { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 7px 16px; }
.dur:has(input:checked) span { border-color: rgba(47,224,160,.7); background: rgba(47,224,160,.1); color: var(--brand); }
.dur.off { opacity: .4; cursor: not-allowed; }
.prompt-card .opts { grid-template-columns: repeat(2, 1fr); }
.tpl-video { width: 100%; max-height: 360px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; margin-bottom: 10px; background: #0d1014; }
@media (max-width: 640px) { .styles { grid-template-columns: repeat(2, 1fr); } .style .thumb { max-height: 220px; } .prompt-card .opts { grid-template-columns: 1fr; } }

/* เติมเครดิต + ระบบรายปี */
.topup-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 8px 0 14px; }
.topup { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; text-align: center; }
.topup.hot { border-color: rgba(232,182,76,.6); background: rgba(232,182,76,.06); }
.topup .amt { font-size: 24px; font-weight: 700; }
.topup .get { color: var(--muted); }
.topup .get b { color: var(--text, #fff); }
.topup .bonus { color: var(--gold); font-weight: 600; font-size: 14px; min-height: 1.4em; }
.system-card { position: relative; }
.opts2 { display: grid; gap: 0 12px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .opts2 { grid-template-columns: 1fr; } }

/* แดชบอร์ดแอดมิน */
.ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 5px 13px; color: var(--muted); font-size: 14px; }
.chip.on { border-color: rgba(47,224,160,.7); color: var(--brand); background: rgba(47,224,160,.08); text-decoration: none; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 14px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { color: var(--muted); font-size: 13.5px; }
.kpi b { font-size: 26px; font-weight: 700; color: var(--ink); }
.kpi b.neg { color: #ff8a7a; }
.kpi small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.kpi.hl { border-color: rgba(47,224,160,.45); }
.legend { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-left: 8px; }
.sw.rev, .dchart .rev { background: #20a6b8; fill: #20a6b8; }
.sw.cost, .dchart .cost { background: #c08a30; fill: #c08a30; }
.dchart { width: 100%; height: auto; margin-top: 12px; display: block; }
.dchart .base { stroke: var(--line2); stroke-width: 1; }
.dchart .ax { fill: var(--muted); font-size: 11px; }
.dchart .hit { fill: transparent; }
.dchart .day:hover .hit { fill: rgba(255,255,255,.05); }
.tblwrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; }

/* ปุ่ม Google */
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; margin-top: 8px; }
.btn.google:hover { background: #f4f6f8; text-decoration: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 16px 0 4px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ตรวจบท + สั่งหลายหัวข้อ */
.badge.script_review { background: var(--warn-soft); color: var(--warn); }
.badge.cancelled { background: rgba(255,255,255,.07); color: var(--muted); }
.script-review textarea { min-height: 64px; }
.batch-toggle { margin-top: 8px; }
#topics { margin-top: 0; }

/* เลือกเสียง + ฟังตัวอย่าง */
.voices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 6px; }
.voice { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin: 0; cursor: pointer; }
.voice input { position: absolute; opacity: 0; pointer-events: none; }
.voice:has(input:checked) { border-color: rgba(47,224,160,.7); background: rgba(47,224,160,.07); }
.voice .play { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1px solid var(--line2); background: transparent; color: var(--brand); cursor: pointer; font-size: 13px; }
.voice .play:hover { background: rgba(47,224,160,.12); }
.voice span { display: flex; flex-direction: column; line-height: 1.35; }
.voice small { color: var(--muted); font-size: 12.5px; }

.btn.danger { color: #ff8a8a; border-color: rgba(255,120,120,.35); }
.btn.danger:hover { background: rgba(255,90,90,.12); border-color: rgba(255,120,120,.6); }

/* แจ้งเตือนหลังทำรายการ: สีตามประเภท + ไอคอน + หัวข้อ */
.toast { display: flex; gap: 14px; align-items: flex-start; margin: 16px 0 20px; padding: 15px 16px 15px 14px; border-radius: 14px;
  border: 1px solid; border-left-width: 5px; font-size: 16px; line-height: 1.5; color: var(--text, #eef3f1);
  box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: toast-in .35s cubic-bezier(.2,.9,.3,1.3); }
.toast .t-ico { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #0b0f0e; }
.toast .t-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toast .t-body b { font-size: 16.5px; }
.toast .t-x { background: none; border: 0; color: inherit; opacity: .6; font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.toast .t-x:hover { opacity: 1; }
.toast.ok { background: linear-gradient(90deg, rgba(67,217,143,.32), rgba(67,217,143,.12)); border-color: rgba(67,217,143,.55); }
.toast.ok .t-ico { background: var(--ok); } .toast.ok b { color: var(--ok); }
.toast.warn { background: linear-gradient(90deg, rgba(240,178,74,.34), rgba(240,178,74,.12)); border-color: rgba(240,178,74,.6); }
.toast.warn .t-ico { background: var(--warn); } .toast.warn b { color: var(--warn); }
.toast.bad { background: linear-gradient(90deg, rgba(255,122,107,.34), rgba(255,122,107,.12)); border-color: rgba(255,122,107,.6); }
.toast.bad .t-ico { background: var(--bad); } .toast.bad b { color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.short { margin: 14px 0 4px; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(240,178,74,.6); border-left-width: 5px;
  background: linear-gradient(90deg, rgba(240,178,74,.2), rgba(240,178,74,.06)); line-height: 1.6; }
.short b { color: var(--warn); }
.big-btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.5); }
.short .alts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ref-row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.ref-row input { flex: 1; font-family: ui-monospace, monospace; }
@media (max-width: 560px) { .ref-row { flex-direction: column; align-items: stretch; } }

/* ข้อมูลสินค้า (เทมเพลตขายของ affiliate) */
.prodbox { border: 1px solid rgba(232,182,76,.45); border-radius: 14px; padding: 6px 16px 16px; margin: 16px 0 4px; background: rgba(232,182,76,.05); }
.prodbox legend { padding: 0 8px; color: #e8b64c; font-weight: 700; }
.prodbox input[type=file] { width: 100%; }

/* จุดคุ้มทุนระบบรายปี */
.be { margin: 10px 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(47,224,160,.07); border: 1px solid rgba(47,224,160,.3); font-size: .95em; }
.be ul { margin: 6px 0 6px 18px; padding: 0; }

/* ระดับคุณภาพบท: STANDARD / PLUS / PREMIUM */
.tier .ti-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.tier .ti-ico { width: 22px; height: 22px; flex: none; }
.tier .ti-en { font-weight: 800; letter-spacing: .06em; font-size: 15px; }
.tier-eco .ti-head { color: #c9d4d0; }
.tier-standard .ti-head { color: #5b9bff; }
.tier-premium .ti-head { color: #e8b64c; }

/* ---------------------------------------------------------------- ธีมสว่าง (ผู้ใช้เลือกในหน้าตั้งค่า) */
html[data-theme=light] {
  --bg: #f3f6f5; --bg2: #ffffff; --card: #ffffff; --card-solid: #ffffff; --ink: #13201c; --muted: #5b6b65;
  --line: rgba(10,30,25,.10); --line2: rgba(10,30,25,.18);
  --brand: #0f9f6e; --brand2: #0e8fa0; --gold: #b07d12; --gold2: #d4a12c; --brand-soft: rgba(15,159,110,.10);
  --ok: #138a55; --ok-soft: rgba(19,138,85,.10); --warn: #b97808; --warn-soft: rgba(185,120,8,.10);
  --bad: #c8412f; --bad-soft: rgba(200,65,47,.10);
  --shadow: 0 8px 30px rgba(10,30,25,.08); --text: var(--ink);
  color-scheme: light;
}
html[data-theme=light] .glow { opacity: .35; }
html[data-theme=light] body::before { opacity: .6; }
html[data-theme=light] .card, html[data-theme=light] .prompt-card { background: #fff; box-shadow: var(--shadow); }
html[data-theme=light] .side .new { background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(10,30,25,.15); }
html[data-theme=light] .side .new:hover { background: #000; }
html[data-theme=light] select option { background: #fff; }
html[data-theme=light] .btn:not(.primary):not(.gold):not(.ok):not(.google):not(.link) { background: #fff; border-color: rgba(10,30,25,.22); color: var(--ink); }
html[data-theme=light] .btn:not(.primary):not(.gold):not(.ok):not(.google):not(.link):hover { background: #eef3f1; }
html[data-theme=light] .btn.primary, html[data-theme=light] .btn.ok { background: linear-gradient(135deg, #0c8a5f, #0b7d8c); border-color: transparent; }
html[data-theme=light] .btn.ok { background: #138a55; }
html[data-theme=light] .btn.primary:hover { box-shadow: 0 8px 24px rgba(12,138,95,.30); }
html[data-theme=light] .btn.gold { background: linear-gradient(120deg, #f2cf6e, #d9a227); color: #2a1c02; }
html[data-theme=light] .btn.danger { color: #b3261e; border-color: rgba(179,38,30,.40); }
html[data-theme=light] .btn.danger:hover { background: rgba(179,38,30,.08); }
html[data-theme=light] .btn.link { color: #4a5a54; }
html[data-theme=light] .btn.link:hover { color: var(--ink); }
html[data-theme=light] .btn.primary, html[data-theme=light] .btn.ok { color: #fff; }
html[data-theme=light] .badge, html[data-theme=light] .badge.cancelled { background: rgba(10,30,25,.06); }
html[data-theme=light] input, html[data-theme=light] textarea, html[data-theme=light] select { background: #fff; color: var(--ink); }
html[data-theme=light] .log { background: #f0f3f2; color: #26342f; }
.themes { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 10px; border-radius: 14px; border: 1px solid var(--line2); min-width: 110px; }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.theme-opt .sw { width: 86px; height: 54px; border-radius: 10px; border: 1px solid var(--line2); }
.theme-dark .sw { background: linear-gradient(135deg, #07090a 55%, #2fe0a0 55% 65%, #07090a 65%); }
.theme-light .sw { background: linear-gradient(135deg, #f3f6f5 55%, #0f9f6e 55% 65%, #ffffff 65%); }
.theme-auto .sw { background: linear-gradient(90deg, #07090a 50%, #f3f6f5 50%); }
html[data-theme=light] .side { background: rgba(255,255,255,.85); }
html[data-theme=light] .side .label { color: #7b8a84; }
html[data-theme=light] .side nav a.on { background: linear-gradient(90deg, rgba(15,159,110,.14), rgba(15,159,110,.02)); }
html[data-theme=light] .promo a { color: #fff; }

/* แถวคลิปในหน้าหลัก: คลิกได้ทั้งแถว */
.clip-row { position: relative; border-radius: 12px; transition: background .15s; }
.clip-row:hover { background: var(--brand-soft); }
.clip-row .row-link::after { content: ""; position: absolute; inset: 0; }
.clip-row .row-go { color: var(--brand); font-weight: 600; font-size: 14px; white-space: nowrap; padding-right: 6px; }
.clip-row .badge { display: inline-flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: livepulse 1.2s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .25; transform: scale(.7); } }
@media (max-width: 560px) { .clip-row .row-go { display: none; } }

/* ขอไอเดียหัวข้อ (อยู่ในกล่องสั่งงาน) */
.idea-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.idea-btn { border-color: rgba(232,182,76,.45); color: var(--gold); }
.ideas { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.ideas summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.ideas .sugg { max-height: 340px; overflow-y: auto; }
.ideas #useall { margin: 6px 0 4px; }
.sugg button.picked { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

.exp-soon { color: var(--warn); font-weight: 600; }

/* เตือนแอดมิน: รายรับรายปีใกล้เกณฑ์ VAT 1.8 ล้าน */
.vat-alert { border-radius: 14px; padding: 12px 16px; margin: 0 0 16px; font-size: 14px; line-height: 1.6; border: 1px solid; }
.vat-alert.lv1 { background: rgba(232,182,76,.10); border-color: rgba(232,182,76,.45); }
.vat-alert.lv2 { background: rgba(255,150,60,.14); border-color: rgba(255,150,60,.6); }
.vat-alert.lv3 { background: rgba(255,90,80,.16); border-color: rgba(255,90,80,.7); }

/* ชวนสมัคร PRO (6 ธ.ค. 2569) */
.pro-nudge { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-color: rgba(232,182,76,.45);
  background: linear-gradient(90deg, rgba(232,182,76,.08), transparent); }
.pro-nudge .grow { flex: 1; min-width: 220px; } .pro-nudge p { margin: 4px 0 0; } .pro-nudge form { margin: 0; }
.pro-more { color: var(--gold, #e8b64c); font-size: 13px; margin: 2px 0 6px; }
.logo-lock { display: flex; gap: 18px; align-items: center; }
.phone-mock { flex: 0 0 auto; width: 78px; height: 138px; border-radius: 12px; border: 1px solid var(--line2, rgba(255,255,255,.2));
  background: linear-gradient(160deg, rgba(47,224,160,.18), rgba(22,184,200,.06)); position: relative; padding: 34px 8px 0; box-sizing: border-box; }
.phone-mock .logo-slot { position: absolute; top: 6px; right: 6px; font-size: 9px; line-height: 1.15; text-align: center; padding: 3px 4px;
  border: 1px dashed var(--gold, #e8b64c); color: var(--gold, #e8b64c); border-radius: 5px; }
.phone-mock i { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 0 0 6px; }
.phone-mock i:first-of-type { margin-top: 62px; } .phone-mock i.short { width: 60%; }
html[data-theme=light] .phone-mock i { background: rgba(0,0,0,.18); }
