:root{
    --bg:#F8FAFC; --card:#FFFFFF; --ink:#1E293B; --muted:#475569; --line:#CBD5E1;
    --brand:#059669; --brand-d:#047857; --brand-soft:#ECFDF5;
    --brand-grad:linear-gradient(135deg, #059669 0%, #047857 100%);
    --action:#EA580C; --action-d:#C2410C;
    --copy-ok:#15803D;
    --accent:#EA580C; --accent-soft:#FFF7ED;
    --danger:#DC2626; --danger-soft:#FEF2F2;
    --radius:18px;
    --shadow:0 2px 12px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
    --shadow-hover:0 10px 26px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.05);
}
*{box-sizing:border-box}
html{font-size:17px}
body{
    margin:0;
    background:var(--bg);
    color:var(--ink);
    font-family:'Noto Sans Thai','Prompt','Sarabun','Leelawadee UI','Tahoma',system-ui,sans-serif;
    line-height:1.6; -webkit-text-size-adjust:100%;
}
body.plain{padding:24px 0}
.wrap{max-width:960px; margin:0 auto; padding:0 16px}
.wrap.narrow{max-width:640px}
h1,h2,h3{font-family:'Prompt','Noto Sans Thai',sans-serif; line-height:1.35; margin:0 0 .5em; letter-spacing:-.01em; color:var(--ink)}
h1{font-size:clamp(1.375rem, 3vw, 1.65rem); font-weight:700}
h2{font-size:1.25rem; font-weight:700}
h3{font-size:1.08rem; font-weight:600}
p{margin:.4em 0 .8em}
code{background:#f0ece4; padding:2px 7px; border-radius:6px; font-size:.9em}
.muted{color:var(--muted)} .center{text-align:center}
.ok{color:var(--brand-d); font-weight:700}
pre.err{background:var(--danger-soft); color:var(--danger); padding:12px; border-radius:10px; white-space:pre-wrap; font-family:inherit}

/* top bar */
.topbar{
    background:rgba(255,255,255,.9);
    backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    border-bottom:1px solid rgba(228,221,210,.85);
    position:sticky; top:0; z-index:20;
    box-shadow:0 1px 8px rgba(30,45,38,.04);
}
.bar{display:flex; align-items:center; justify-content:space-between; gap:10px; padding-top:11px; padding-bottom:11px}
.brand{font-weight:700; font-size:1.08rem; color:var(--brand-d); display:inline-flex; align-items:center; gap:6px}
.bar-actions{display:flex; gap:6px}

/* hero */
.hero{text-align:center; padding:26px 0 10px}
.hero h1{font-size:clamp(1.45rem, 3vw, 1.95rem); color:#18241e}
.hero p{color:var(--muted); max-width:660px; margin-left:auto; margin-right:auto}
.steps{list-style:none; display:flex; flex-wrap:wrap; justify-content:center; gap:8px; padding:0; margin:14px 0 0}
.steps li{background:#fff; border:1px solid var(--line); border-radius:999px; padding:6px 14px; font-size:.92rem}
.steps b{display:inline-grid; place-items:center; width:1.55em; height:1.55em; border-radius:50%; background:var(--brand); color:#fff; font-size:.85em; margin-right:6px}

/* cards & forms */
.card{
    background:var(--card); border:1px solid rgba(228,221,210,.9);
    border-radius:var(--radius); box-shadow:var(--shadow);
    padding:22px; margin:16px 0;
    transition:box-shadow .18s ease, border-color .18s ease;
}
.card-head{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px}
.card-head h2{margin:0; display:flex; align-items:center; gap:10px}
.num{display:inline-grid; place-items:center; min-width:1.9em; height:1.9em; border-radius:50%; background:var(--brand-grad); color:#fff; font-size:.88em; box-shadow:0 2px 6px rgba(40,122,87,.25)}
.field{display:block; margin:14px 0}
.lbl{display:block; font-weight:600; margin-bottom:6px}
.lbl em{color:var(--accent); font-style:normal; font-size:.82em; font-weight:600; margin-left:4px}
.lbl small{color:var(--muted); font-weight:400}
input[type=text],input[type=search],input[type=password],input[type=number],textarea,select{
    width:100%; font:inherit; color:inherit; background:#fff;
    border:1.5px solid var(--line); border-radius:12px; padding:11px 14px; min-height:46px;
    transition:border-color .15s, box-shadow .15s;
}
input[type=text]:hover,input[type=search]:hover,input[type=password]:hover,input[type=number]:hover,textarea:hover,select:hover{border-color:#c8dfd3}
textarea{resize:vertical}
input:focus,textarea:focus,select:focus,button:focus-visible,summary:focus-visible{outline:3px solid #9bd3b8; outline-offset:1px; border-color:var(--brand)}
.err{display:block; color:var(--danger); font-size:.9rem; margin-top:4px}
.err[hidden]{display:none}
.field.invalid input,.field.invalid textarea{border-color:var(--danger)}
.grid2{display:grid; grid-template-columns:1fr; gap:0 14px}
@media(min-width:680px){.grid2{grid-template-columns:1fr 1fr}}
.check{display:flex; gap:10px; align-items:flex-start; cursor:pointer; padding:8px 2px}
.check input{width:22px; height:22px; margin-top:3px; accent-color:var(--brand); flex:none}
.check small{color:var(--muted)}
.check-field{align-self:end}
.row-actions{display:flex; flex-wrap:wrap; gap:8px; margin-top:6px}

/* chips — Single Column on Mobile, Touch Target >= 48px, Checkmark ✓ */
.chips{display:grid; gap:10px}
.cat-grid{grid-template-columns:1fr}
@media(min-width:560px){.cat-grid{grid-template-columns:1fr 1fr}}
@media(min-width:820px){.cat-grid{grid-template-columns:1fr 1fr 1fr}}
.tone-grid{grid-template-columns:1fr}
@media(min-width:560px){.tone-grid{grid-template-columns:1fr 1fr}}
@media(min-width:820px){.tone-grid{grid-template-columns:repeat(4,1fr)}}
.chip{
    font:inherit; color:var(--ink); text-align:left; cursor:pointer;
    display:flex; align-items:center; gap:10px;
    background:#fff; border:1.5px solid var(--line); border-radius:14px; padding:12px 14px; min-height:52px;
    transition:border-color .15s, background .15s, transform .08s, box-shadow .15s;
}
.chip:hover{border-color:#6ee7b7; background:#f8fffc}
.chip:active{transform:scale(.99)}
.chip .ico{font-size:1.45em; line-height:1}
.chip[aria-checked=true]{border-color:var(--brand); background:var(--brand-soft); box-shadow:inset 0 0 0 1px var(--brand); font-weight:700; color:var(--brand-d)}
.chip[aria-checked=true]::after{content:'✓'; margin-left:auto; font-weight:700; color:var(--brand)}
.chip.tone{justify-content:center; text-align:center}
.chip.tone[aria-checked=true]::after{margin-left:6px}
.tone-info{margin-top:12px; background:var(--accent-soft); border-left:4px solid var(--action); border-radius:12px; padding:12px 14px}
.tone-info p{margin:.2em 0}
.tone-info .eg{color:var(--muted); font-size:.95rem}

/* buttons — Touch Target >= 48px */
.btn{
    font:inherit; font-weight:600; cursor:pointer; border-radius:14px; border:1.5px solid transparent;
    padding:12px 18px; min-height:48px; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; gap:8px;
    transition:background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active{transform:scale(.98)}
.btn.primary{background:var(--brand-grad); color:#fff; box-shadow:0 2px 8px rgba(5,150,105,.24)}
.btn.primary:hover{background:var(--brand-d); box-shadow:0 4px 14px rgba(5,150,105,.32); transform:translateY(-1px)}
.btn.primary.is-gen,.btn.action{background:var(--action); color:#fff; box-shadow:0 3px 12px rgba(234,88,12,.28)}
.btn.primary.is-gen:hover,.btn.action:hover{background:var(--action-d); box-shadow:0 5px 16px rgba(234,88,12,.36)}
.btn.primary:disabled{opacity:.6; cursor:progress; transform:none}
.btn.ghost{background:#fff; color:var(--ink); border-color:var(--line)}
.btn.ghost:hover{background:var(--brand-soft); border-color:var(--brand); color:var(--brand-d)}
.btn.small{min-height:44px; padding:8px 14px; font-size:.92rem}
.btn.big{font-size:1.12rem; min-height:58px; width:100%}
.btn.danger{color:var(--danger)}
.cta{max-width:520px; margin:18px auto}

/* tabs */
.tabs{display:flex; gap:6px; margin:8px 0 14px; overflow-x:auto; padding-bottom:2px}
.tab{
    font:inherit; font-weight:600; cursor:pointer; white-space:nowrap; flex:1;
    border:1.5px solid var(--line); background:#fff; border-radius:12px; padding:10px 12px; min-height:46px;
}
.tab.active{background:var(--brand); border-color:var(--brand); color:#fff}
.panel[hidden]{display:none}

details.opts,details.summary{border:1px solid var(--line); border-radius:12px; padding:8px 12px; margin:0 0 12px; background:#fcfbf8}
details summary{cursor:pointer; font-weight:600; padding:4px 0}
.opts-grid{display:grid; grid-template-columns:1fr; gap:0 14px; padding-top:6px}
@media(min-width:680px){.opts-grid{grid-template-columns:1fr 1fr}}
.opts-grid .field{margin:8px 0}
.opts-grid .lbl{font-size:.92rem; font-weight:500; margin-bottom:3px}
details.summary ul{margin:.4em 0 .6em; padding-left:1.2em}
details.summary li{margin:.2em 0}

.warn{background:var(--accent-soft); border-left:5px solid var(--accent); border-radius:10px; padding:10px 14px; margin:0 0 12px; font-size:.95rem}
.warn[hidden]{display:none}
.warn ul{margin:0; padding-left:1.1em}

/* prompt blocks */
.block{border:1.5px solid var(--line); border-radius:14px; padding:12px; margin:0 0 14px; background:#fff}
.block h3{margin:0 0 8px; font-size:1rem}
.block textarea{
    font-family:ui-monospace,'Cascadia Mono','Consolas','Noto Sans Thai',monospace; font-size:.9rem; line-height:1.55;
    background:#f7f5ef; min-height:180px; max-height:520px;
}
.block-actions{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:10px 0 4px}
.copy-btn{min-width:190px; background:var(--action); color:#fff; border-color:transparent}
.copy-btn:hover{background:var(--action-d)}
.copy-btn.done{background:var(--copy-ok)!important; color:#fff}
.copy-top.done{background:var(--copy-ok)!important; color:#fff}
.howto{font-size:.93rem; color:var(--muted); margin:6px 0 0}
.links{display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:6px; font-size:.92rem}
.links a{
    text-decoration:none; color:var(--brand-d); background:var(--brand-soft); border-radius:999px; padding:4px 12px; font-weight:600;
}
.links a:hover{background:#d3ebdf}
.loading{opacity:.55; pointer-events:none}

.tips ul{margin:.3em 0; padding-left:1.2em}
.tips li{margin:.35em 0}
.foot{padding:20px 0 40px; color:var(--muted); text-align:center; font-size:.9rem}

/* drawer */
.drawer{position:fixed; inset:0; z-index:50}
.drawer[hidden]{display:none}
.drawer-back{position:absolute; inset:0; background:rgba(20,30,25,.45)}
.drawer-panel{
    position:absolute; right:0; top:0; bottom:0; width:min(480px,100%); background:#fff; padding:16px; overflow-y:auto;
    box-shadow:-6px 0 24px rgba(0,0,0,.18);
}
.drawer-head{display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px}
.drawer-head h3{margin:0}
.item{border:1.5px solid var(--line); border-radius:12px; padding:10px 12px; margin:0 0 10px}
.item .t{font-weight:700}
.item .m{color:var(--muted); font-size:.88rem}
.item .a{display:flex; gap:8px; margin-top:8px}
.empty{color:var(--muted); text-align:center; padding:24px 0}

.toast{
    position:fixed; left:50%; bottom:22px; transform:translateX(-50%); z-index:60;
    background:#26302b; color:#fff; padding:10px 18px; border-radius:999px; font-size:.95rem; max-width:90vw; box-shadow:0 6px 20px rgba(0,0,0,.25);
}
.toast[hidden]{display:none}
.toast.bad{background:var(--danger)}

@media print{.topbar,.cta,.drawer,.toast{display:none}}

/* ปรับสำหรับมือถือ */
.bar-actions .btn{min-height:38px; padding:4px 10px; font-size:.88rem; white-space:nowrap}
.brand{font-size:.98rem; line-height:1.3}
.tab{flex:1 1 0; min-width:0; padding:8px 4px; font-size:.92rem; white-space:normal; line-height:1.3}

/* ===== v2: ใช้งานง่ายขึ้น ===== */
html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto} *{transition:none!important}}
#card-product,#card-tone,#results{scroll-margin-top:70px}

/* ตัวนำทางขั้นตอน */
.steps li{padding:0}
.steps a{display:block; padding:6px 14px; color:inherit; text-decoration:none; border-radius:999px}
.steps li.current{border-color:var(--brand); box-shadow:0 0 0 2px var(--brand-soft)}
.steps li.done{background:var(--brand-soft); border-color:var(--brand)}
.steps li.done b{background:var(--brand-d)}
.steps li.done b::before{content:'✓'}
.steps li.done b{font-size:0}
.steps li.done b::before{font-size:.85rem}
.kinds-line{display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin:10px 0 0}
.kinds-line span{background:var(--brand-soft); color:var(--brand-d); border-radius:999px; padding:2px 10px; font-size:.82rem; font-weight:600}

/* ฟอร์ม */
.head-actions{display:flex; gap:6px; flex-wrap:wrap}
.editing{background:var(--accent-soft); border-radius:12px; padding:8px 12px; margin:8px 0 0; font-size:.95rem}
.editing[hidden],.stale[hidden],.dirty-note[hidden],.off-note[hidden],.ph-note[hidden]{display:none}
.counter{display:block; text-align:right; color:var(--muted); font-size:.82rem; margin-top:2px}
.lbl em{background:var(--accent-soft); border-radius:999px; padding:1px 8px}
.field.off{opacity:.55}
.off-note{display:block; color:var(--muted); margin-top:3px}

/* ปุ่มสร้างลอยติดล่างจอ */
.cta{position:sticky; bottom:0; z-index:15; max-width:none; margin:18px -16px 0; padding:10px 16px calc(10px + env(safe-area-inset-bottom));
     background:linear-gradient(to top, var(--bg) 70%, rgba(250,247,242,0))}
.cta .btn.big{max-width:520px; margin:0 auto}
.cta .muted{margin:0 0 6px; font-size:.9rem}
.toast{bottom:96px}

/* ผลลัพธ์ */
.stale,.dirty-note{display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between;
     background:var(--accent-soft); border-left:5px solid var(--accent); border-radius:10px; padding:10px 14px; margin:0 0 12px; font-size:.95rem}
.tabs{display:grid; grid-template-columns:repeat(2,1fr); gap:6px; overflow:visible}
@media(min-width:560px){.tabs{grid-template-columns:repeat(4,1fr)}}
.tab{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:8px 4px; min-height:56px; font-size:.9rem; line-height:1.25}
.tab-ico{font-size:1.3rem; line-height:1}
.tab:hover:not(.active){background:var(--brand-soft)}
.panel-title{font-weight:700; margin:0 0 8px; color:var(--brand-d)}
.block-head{display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px}
.block-head h3{margin:0}
.copy-top{flex:none}
.copy-top.done{background:var(--brand-d)}
.ph-note{background:var(--accent-soft); border-radius:10px; padding:6px 12px; margin:8px 0 0; font-size:.92rem}
.btn:disabled{opacity:.6; cursor:not-allowed}

/* ลิ้นชัก */
.drawer-panel{outline:none}
.item .m + .m{margin-top:2px}

/* ===== v3: เป้าหมาย / ข้อมูลร้าน / ลิงก์ AI แนะนำ / ให้คะแนน / สำรองข้อมูล ===== */
#card-goal{scroll-margin-top:70px}
.goal-grid{display:grid; grid-template-columns:1fr; gap:10px}
@media(min-width:620px){.goal-grid{grid-template-columns:1fr 1fr}}
@media(min-width:860px){.goal-grid{grid-template-columns:1fr 1fr 1fr}}
.goal{font:inherit; color:var(--ink); text-align:left; cursor:pointer; display:flex; gap:12px; align-items:center;
      background:#fff; border:1.5px solid var(--line); border-radius:14px; padding:14px; min-height:64px;
      transition:border-color .15s, background .15s, box-shadow .15s, transform .1s}
.goal:hover{border-color:#6ee7b7; background:#f8fffc; box-shadow:0 4px 12px rgba(5,150,105,.08); transform:translateY(-1px)}
.goal[aria-pressed=true]{border-color:var(--brand); background:var(--brand-soft); box-shadow:inset 0 0 0 1px var(--brand), 0 4px 12px rgba(5,150,105,.12)}
.goal[aria-pressed=true]::after{content:'✓'; margin-left:auto; font-weight:700; font-size:1.1rem; color:var(--brand)}
.g-ico{font-size:1.55em; line-height:1.2; flex:none}
.g-txt{display:flex; flex-direction:column; gap:2px}
.g-txt small{color:var(--muted); font-size:.86rem; line-height:1.4}
.kind-pick{margin-top:16px; padding-top:14px; border-top:1px dashed var(--line)}
.kind-pills{display:flex; flex-wrap:wrap; gap:10px}
.kpill{font:inherit; font-size:.94rem; color:var(--ink); cursor:pointer; background:#fff; border:1.5px solid var(--line); border-radius:999px; padding:10px 16px; min-height:48px; position:relative; transition:background .15s, border-color .15s, transform .1s}
.kpill[aria-pressed=true]{background:var(--brand-grad); border-color:var(--brand); color:#fff; font-weight:700; box-shadow:0 2px 8px rgba(5,150,105,.24)}
.kpill[aria-pressed=true][data-n]:not([data-n=""])::before{content:attr(data-n) ". "; opacity:.9}
.kpill[aria-pressed=true]::after{content:' ✓'; font-weight:700}
.kpill:hover:not([aria-pressed=true]){background:var(--brand-soft); border-color:var(--brand)}

details.shop{border:1px solid var(--line); border-radius:12px; padding:8px 12px; margin:12px 0 0; background:#fcfbf8}
details.shop summary small{color:var(--muted); font-weight:400}
.small-note{font-size:.88rem; margin:4px 0 6px}
.photo-help{grid-column:1/-1; margin:0 0 6px}
.linkbtn{font:inherit; background:none; border:0; padding:6px 0; color:var(--brand-d); font-weight:600; cursor:pointer; text-align:left; text-decoration:underline; text-underline-offset:3px}
.linkbtn:hover{color:var(--brand)}

/* ลิงก์ AI แนะนำ */
.links-wrap{margin-top:8px}
.links-wrap .links{margin-top:4px}
.links a.rec{background:var(--brand); color:#fff}
.links a.rec:hover{background:var(--brand-d)}
.rec-why{font-size:.86rem; color:var(--muted); margin:2px 0 6px}

/* ให้คะแนน prompt */
.fb{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:10px; padding-top:10px; border-top:1px dashed var(--line); font-size:.92rem}
.fb-status{font-size:.9rem}
.fb-note{display:flex; gap:6px; width:100%}
.fb-note[hidden]{display:none}
.fb-note input{flex:1; min-height:40px}

/* เช็กลิสต์ (ไม่ใช่ prompt) */
.block textarea.plain{background:#fffdf5; font-family:inherit; font-size:.97rem}
.panel-next{margin-top:14px; text-align:right}
.panel-next[hidden]{display:none}
.tab[hidden]{display:none}

/* สำรองข้อมูลในลิ้นชัก */
.drawer-tools{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:0 0 12px; padding-bottom:10px; border-bottom:1px dashed var(--line)}
.drawer-tools small{flex-basis:100%}
/* ===== v4: เมนู / ส่วนท้าย / ขั้นตอนแบบเป็นหน้า / แอดมิน ===== */
.skip-link{position:absolute; left:-999px; top:0}
.skip-link:focus{left:8px; top:8px; background:#fff; padding:8px 12px; border-radius:8px; z-index:100; box-shadow:var(--shadow)}
.brand{text-decoration:none; color:var(--brand-d)}
.bar{flex-wrap:wrap}
.menu-toggle{display:none; font:inherit; font-weight:600; cursor:pointer; background:#fff; border:1.5px solid var(--line); border-radius:12px; padding:6px 12px; min-height:40px; color:var(--brand-d)}
.site-menu{display:flex; gap:6px; align-items:center; flex-wrap:wrap}
.menu-link{font:inherit; font-size:.9rem; font-weight:600; color:var(--brand-d); text-decoration:none; background:#fff; border:1.5px solid var(--line);
    border-radius:12px; padding:6px 12px; min-height:40px; display:inline-flex; align-items:center; cursor:pointer; white-space:nowrap}
.menu-link:hover{background:var(--brand-soft)}
.menu-link.active{background:var(--brand); color:#fff; border-color:var(--brand)}
@media(max-width:720px){
    .menu-toggle{display:inline-flex; align-items:center}
    .site-menu{display:none; width:100%; flex-direction:column; align-items:stretch; padding:8px 0 4px}
    .site-menu.open{display:flex}
    .menu-link{justify-content:flex-start}
}

.site-foot{border-top:1px solid var(--line); margin-top:30px; background:#fff}
.site-foot a{color:var(--brand-d)}
.foot-links{display:flex; gap:16px; justify-content:center; flex-wrap:wrap; margin-bottom:8px; font-weight:600}
.credit{border-top:1px solid var(--line); padding-top:10px; margin-top:12px; color:var(--ink); line-height:1.7}

.narrow-page{max-width:780px}
.howto-list{padding-left:1.3em} .howto-list li{margin:.5em 0}
.kind-list{padding-left:1.2em} .kind-list li{margin:.3em 0}
.dev-card{background:var(--brand-soft)}

/* ขั้นตอนแบบเป็นหน้า */
.wizard{margin:12px 0 4px}
.wiz-steps{list-style:none; display:flex; gap:4px; padding:0; margin:0 0 8px; justify-content:space-between}
.wiz-steps li{flex:1 1 0; min-width:0}
.wiz-steps button{width:100%; font:inherit; background:none; border:0; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:4px; padding:4px 2px; color:var(--muted); border-radius:10px}
.wiz-steps button:hover b{border-color:var(--brand)}
.wiz-steps b{display:grid; place-items:center; width:2.2em; height:2.2em; border-radius:50%; background:#fff; border:2px solid var(--line); color:var(--muted); font-size:.95rem}
.wiz-steps span{font-size:.78rem; line-height:1.25; text-align:center}
.wiz-steps li.current b{background:var(--brand); border-color:var(--brand); color:#fff}
.wiz-steps li.current button{color:var(--ink); font-weight:700}
.wiz-steps li.done b{background:var(--brand-soft); border-color:var(--brand); color:var(--brand-d); font-size:0}
.wiz-steps li.done b::before{content:'✓'; font-size:1rem}
.wiz-bar{height:6px; background:#E2E8F0; border-radius:99px; overflow:hidden}
.wiz-bar i{display:block; height:100%; width:0; background:var(--brand-grad); transition:width .25s}
.wiz-hint{margin:8px 0 0; text-align:center; font-size:.9rem; font-weight:600; color:var(--brand-d)}
.step[hidden]{display:none}
.step-title:focus{outline:none}
.wiz-nav{position:sticky; bottom:0; z-index:15; margin:18px -16px 0; padding:12px 16px calc(12px + env(safe-area-inset-bottom));
    background:rgba(255,255,255,.96); backdrop-filter:blur(10px); border-top:1px solid #E2E8F0; box-shadow:0 -4px 16px rgba(15,23,42,.06)}
.wiz-nav .muted{margin:0 0 6px; font-size:.9rem}
.wiz-btns{display:flex; gap:8px; max-width:600px; margin:0 auto}
.wiz-btns .btn{flex:1 1 0}
.wiz-btns #btn-generate{flex:2 1 0; font-size:1.05rem; min-height:54px}
.wiz-btns .btn[hidden]{display:none}
.aud-desc{display:block; color:var(--muted); font-size:.9rem; margin-top:4px; min-height:1.3em}
.sum-box{margin-top:14px; background:var(--brand-soft); border-radius:12px; padding:10px 14px; font-size:.95rem}
.sum-box ul{margin:.3em 0 0; padding-left:1.2em}
.save-row{margin-top:14px}
#results-empty{padding:40px 0}

/* แอดมิน */
.admin-tabs{display:flex; flex-wrap:wrap; gap:6px; margin:14px 0}
.atab{text-decoration:none; font-weight:600; color:var(--brand-d); background:#fff; border:1.5px solid var(--line); border-radius:12px; padding:8px 14px; min-height:42px; display:inline-flex; align-items:center}
.atab:hover{background:var(--brand-soft)}
.atab.active{background:var(--brand); border-color:var(--brand); color:#fff}
.admin-grid{display:grid; gap:14px}
@media(min-width:760px){.admin-grid.two{grid-template-columns:1fr 1fr}}
.admin-card h3{margin-top:0}
.pill{display:inline-block; border-radius:999px; padding:1px 10px; font-size:.82rem; background:var(--brand-soft); color:var(--brand-d)}
.pill.off{background:#eee; color:#777}
.filter-row{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:8px 0}
.check-list{display:grid; gap:4px; grid-template-columns:1fr}
@media(min-width:560px){.check-list{grid-template-columns:1fr 1fr}}
textarea.mono{font-family:ui-monospace,'Cascadia Mono',Consolas,monospace; font-size:.88rem}
.table-wrap{overflow-x:auto}

/* ===== v5: หน้ารวมเครื่องมือ AI & UI Polish ===== */
.sr-only{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0}
.hero-banner{
    background:linear-gradient(135deg, rgba(255,255,255,.92) 0%, rgba(230,244,237,.65) 100%);
    border:1px solid rgba(228,221,210,.9);
    border-radius:22px;
    padding:28px 20px;
    margin:16px 0 8px;
    box-shadow:var(--shadow);
}
.hero-pill{
    display:inline-flex; align-items:center; gap:6px;
    background:var(--brand-soft); color:var(--brand-d);
    border:1px solid rgba(40,122,87,.2);
    border-radius:999px; padding:4px 14px; font-size:.85rem; font-weight:700;
    margin-bottom:10px;
}
.hero-cta{margin-top:14px}

.tools-filter-card{padding:16px 18px}
.tools-controls{display:flex; flex-direction:column; gap:12px}
.cat-filter{display:flex; flex-wrap:wrap; gap:7px}
.tool-search-wrap{display:block}
.tool-group{margin:24px 0 10px}
.tool-group[hidden]{display:none}
.tool-group-head{margin-bottom:10px; padding:0 2px}
.tool-group-head h2{margin:0 0 2px; font-size:1.25rem; color:#18241e}
.tool-group-head p{margin:0; font-size:.94rem}

.tools-grid{display:grid; grid-template-columns:1fr; gap:14px}
@media(min-width:620px){.tools-grid{grid-template-columns:repeat(2, 1fr)}}
@media(min-width:900px){.tools-grid{grid-template-columns:repeat(3, 1fr)}}

.tool-card{
    margin:0; padding:18px; display:flex; flex-direction:column; gap:10px; height:100%;
    transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-card:hover{transform:translateY(-2px); box-shadow:var(--shadow-hover); border-color:#bedaca}
.tool-card[hidden]{display:none}
.tool-card-head{display:flex; align-items:flex-start; gap:12px}
.tool-ico{
    flex:none; width:46px; height:46px; border-radius:14px; border:1.5px solid transparent;
    display:grid; place-items:center; font-size:1.45rem; line-height:1;
}
.tool-card-top{display:flex; flex-direction:column; gap:5px; min-width:0}
.tool-card-top h3{margin:0; font-size:1.08rem; color:var(--brand-d); line-height:1.3}
.tool-badges{display:flex; flex-wrap:wrap; gap:5px}
.tbadge{
    display:inline-block; font-size:.76rem; font-weight:600;
    padding:2px 9px; border-radius:999px;
    background:var(--brand-soft); color:var(--brand-d);
}
.tool-desc{margin:0; font-size:.93rem; color:var(--ink)}
.tool-tip{
    margin:0; font-size:.86rem; color:var(--muted);
    background:#faf7f0; border-left:3px solid var(--accent);
    padding:7px 10px; border-radius:8px;
}
.tool-card-foot{margin-top:auto; padding-top:4px}
.tool-card-foot .btn{width:100%}

/* ===== v6: จัดกลุ่มชนิดงาน / ปรับขนาดตัวอักษร / ตัวอย่าง / กรองด่วน ===== */
html.font-lg{font-size:19.5px}
.font-toggle{min-width:44px; justify-content:center; font-weight:700}
.font-toggle[aria-pressed=true]{background:var(--brand-soft); border-color:var(--brand); color:var(--brand-d)}

.kind-groups{display:grid; gap:10px}
.kind-group{background:#faf8f3; border:1px solid var(--line); border-radius:14px; padding:10px 12px}
.kind-group-lbl{font-size:.84rem; font-weight:700; color:var(--muted); margin-bottom:7px}

.hero-cta{display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:14px}
.preview-item .preview-ta{margin-top:8px; font-family:ui-monospace,'Cascadia Mono',Consolas,monospace; font-size:.82rem; background:#f7f5ef; min-height:110px}
.tools-all-link{margin:6px 0 0; font-size:.86rem}
.tools-all-link a{color:var(--brand-d); font-weight:600; text-decoration:underline; text-underline-offset:3px}

.tag-filter{display:flex; flex-wrap:wrap; gap:6px; align-items:center}
.tag-lbl{font-size:.88rem; margin-right:2px}
.tag-pill{font-size:.84rem; min-height:34px; padding:4px 12px}
.mt-sm{margin-top:6px}
/* ===== v5: ให้ AI ภายนอกเขียนให้เลย / ผลลัพธ์ AI / ตรวจการเชื่อมต่อ (แอดมิน) ===== */
.ai-chip{margin:0 0 12px; padding:8px 14px; border-radius:12px; background:var(--brand-soft); color:var(--brand-d); font-size:.92rem; border:1px solid #cfe7da}
.ai-chip.low{background:var(--accent-soft); color:#8a4b00; border-color:#f3d3a8}
.ai-chip[hidden]{display:none}
.ai-run{margin-top:12px; padding-top:12px; border-top:1px dashed var(--line)}
.ai-run-row{display:flex; flex-wrap:wrap; gap:10px; align-items:center}
.ai-btn{background:linear-gradient(135deg,#6d4bd1,#2f7d5b); color:#fff; border-color:transparent}
.ai-btn:hover{filter:brightness(1.08)}
.ai-btn:disabled{opacity:.7}
.ai-hint{font-size:.88rem}
.ai-status{margin:8px 0 0; font-size:.9rem}
.ai-status[hidden],.ai-result[hidden]{display:none}
.ai-result{margin-top:10px; padding:12px; border-radius:12px; background:#f6f3ff; border:1px solid #ddd3f7}
.ai-result[aria-busy=true]{opacity:.6}
.ai-result-head{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:8px}
.ai-result-head .btn{margin-left:auto}
.ai-result textarea{background:#fff; min-height:160px}
.ai-error{margin:0 0 6px; color:var(--danger); font-weight:600}
.ai-warn{margin:6px 0; padding:6px 10px; border-radius:8px; background:var(--accent-soft); font-size:.9rem}
.ai-note{font-size:.86rem; margin:8px 0 0}

/* แอดมิน: ผลทดสอบการเชื่อมต่อ */
.diag-list{list-style:none; padding:0; margin:10px 0; display:grid; gap:8px}
.diag-list li{display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border-radius:12px; border:1px solid var(--line); background:#fff}
.diag-list li.ok{border-color:#bfe0cf; background:#f2faf6}
.diag-list li.warn{border-color:#f0d6a8; background:#fff8ec}
.diag-list li.fail{border-color:#f1b8b0; background:#fdf1ef}
.diag-ico{font-size:1.2rem; line-height:1.3}
.diag-body b{display:block}
.diag-ms{margin-left:auto; color:var(--muted); font-size:.85rem; white-space:nowrap}
.model-chips{display:flex; flex-wrap:wrap; gap:6px; margin-top:6px}
.model-chip{font:inherit; font-size:.85rem; cursor:pointer; border:1.5px solid var(--line); background:#fff; border-radius:999px; padding:3px 10px}
.model-chip:hover{background:var(--brand-soft); border-color:var(--brand)}
.env-grid{display:grid; gap:6px; grid-template-columns:1fr}
@media(min-width:640px){.env-grid{grid-template-columns:1fr 1fr}}
.env-grid div{padding:6px 10px; border-radius:10px; background:#fcfbf8; border:1px solid var(--line); font-size:.92rem}