:root {
  --obsidian: #0e1116; --graphite: #151922; --carbon: #1b202b; --steel: #2c3342; --slate: #6b7385;
  --ash: #a3abbd; --porcelain: #eef0f6; --blue: #8b8fff; --link: #a9acff;
  --glass: rgba(var(--bg2), .6); --hair: rgba(var(--ov), .12);
  --green: #3ccf8e; --yellow: #f5b83d; --red: #ff6b6b;
  --font: system-ui, -apple-system, 'Prompt', ui-sans-serif, sans-serif;
  --display: system-ui, -apple-system, 'Prompt', ui-sans-serif, sans-serif;
  --ov: 255, 255, 255; --bg0: 14, 17, 22; --bg1: 21, 25, 34; --bg2: 27, 32, 43; --on-porcelain: #0e1116;
  /* Prism: แสงหักผ่านผลึก ใช้เฉพาะสิ่งที่แสดงโควตา/ความคืบหน้า/สถานะที่กำลังทำงาน */
  --spectrum: linear-gradient(90deg, #14b8d9, #6b6ff5 55%, #e0509f); --accent: #8b8fff; --accent-tint: rgba(139, 143, 255, .14);
  --ink-btn: #eef0f6; --ink-btn-fg: #0e1116; --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark; accent-color: var(--blue);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--obsidian); color: var(--porcelain); font: 400 15px/1.5 var(--font); }
a { color: var(--link); text-decoration: none; }
:focus-visible { outline: 2px solid var(--porcelain); outline-offset: 2px; }
[hidden] { display: none !important; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: rgba(0,0,0,.8); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid #282828; }
.logo { font: 600 19px var(--display); color: var(--porcelain); letter-spacing: .2px; }
.nav .sp { flex: 1; }
.nav a.l { font-size: 13px; color: rgba(var(--ov), .8); padding: 12px 6px; }

/* buttons */
.btn { min-height: 44px; padding: 0 22px; border-radius: 170px; border: 0; font: 500 15px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.out { background: transparent; color: var(--porcelain); box-shadow: 0 0 0 1px var(--slate) inset; }
.btn.dark { background: rgba(66,66,69,.72); color: rgba(var(--ov), .85); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.red { background: transparent; color: var(--red); box-shadow: 0 0 0 1px var(--steel) inset; }
.btn:disabled { opacity: .4; cursor: default; }

/* inputs */
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--steel); background: rgba(var(--ov), .04); color: var(--porcelain); font: 400 15px var(--font); }
textarea { border-radius: 16px; resize: none; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--blue); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--ash); margin: 12px 0 6px 8px; }
input[type=checkbox] { width: auto; min-height: 0; }

/* layout */
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.hero { text-align: center; padding: 90px 16px 48px; }
.hero .name { font: 600 32px/1.13 var(--display); }
.hero h1 { font: 600 40px/1.15 var(--display); letter-spacing: -.5px; margin: 8px 0 16px; }
.hero p { color: var(--ash); font-size: 17px; max-width: 560px; margin: 0 auto 28px; }
@media (min-width: 768px) { .hero h1 { font-size: 80px; letter-spacing: -1.2px; } }
.band { background: linear-gradient(#1d1d1f, #000 288px); border-radius: 28px; padding: 28px 16px; margin: 24px 0 90px; }
.band h2 { font: 600 32px/1.15 var(--display); text-align: center; margin: 0 0 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tile { background: var(--obsidian); border: 1px solid var(--hair); border-radius: 28px; padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--carbon); border: 1px solid var(--hair); border-radius: 28px; padding: 24px; margin: 16px 0; box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.card .tile { background: var(--obsidian); }
.stat { font: 600 28px/1 var(--display); }
.muted { color: var(--ash); font-size: 13px; }
.price { font: 600 40px/1 var(--display); }
.price small { font-size: 15px; color: var(--ash); font-weight: 400; }
.tile.sel { box-shadow: 0 0 0 2px var(--porcelain) inset; }
.err { color: var(--red); font-size: 13px; min-height: 20px; margin: 8px; }
/* error เป็นกรอบ ไม่ใช่ข้อความลอย (ไม่รวม .err ในเทอร์มินัล) */
.err:not(:empty):not(pre .err) { background: color-mix(in srgb, var(--red) 12%, transparent); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); border-left-width: 3px; border-radius: 10px; padding: 10px 12px; line-height: 1.5; text-align: left; overflow-wrap: anywhere; }
.ok { color: var(--green); }
.warn { color: var(--yellow); }

/* auth */
.auth { max-width: 400px; margin: 48px auto; }
.auth h1 { font: 600 32px var(--display); text-align: center; }
.tabs { display: flex; gap: 8px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.tabs button { min-height: 36px; padding: 0 16px; border-radius: 9999px; border: 1px solid var(--steel); background: transparent; color: var(--porcelain); font: 500 14px var(--font); cursor: pointer; }
.tabs button.on { background: var(--porcelain); color: var(--on-porcelain); border-color: var(--porcelain); }

/* chat */
.chat { display: flex; height: 100dvh; }
.side { width: 280px; background: var(--graphite); border-right: 1px solid #282828; display: flex; flex-direction: column; padding: 12px; gap: 8px; }
.side .list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.side .item { display: flex; align-items: center; border-radius: 10px; }
.side .item a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--porcelain); padding: 9px 10px; font-size: 14px; }
.side .item a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .item a .ci { color: var(--ash); flex: none; }
.side .item.on a .ci { color: var(--porcelain); }
.side .item.on, .side .item:hover { background: var(--carbon); }
.side .item button { background: none; border: 0; color: var(--ash); width: 36px; height: 36px; cursor: pointer; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #282828; }
.bar select { width: auto; min-height: 36px; padding: 4px 14px; font-size: 14px; }
.meters { display: flex; gap: 12px; flex: 1; justify-content: flex-end; }
.meter { width: 96px; font-size: 11px; color: var(--ash); }
.meter .track { height: 4px; border-radius: 4px; background: var(--steel); margin-top: 3px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--porcelain); }
.meter.hi .fill { background: var(--yellow); }
.meter.full .fill { background: var(--red); }
.msgs { flex: 1; overflow: auto; padding: 16px 12px; }
.msg { max-width: 760px; margin: 0 auto 16px; line-height: 1.6; word-wrap: break-word; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .b { background: var(--carbon); border-radius: 20px; padding: 10px 16px; max-width: 85%; white-space: pre-wrap; }
.msg .b p { margin: 0 0 10px; }
.msg pre { background: var(--carbon); border-radius: 14px; padding: 14px; overflow: auto; font-size: 13px; }
.msg code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.msg :not(pre) > code { background: var(--carbon); padding: 1px 6px; border-radius: 6px; }
.empty { text-align: center; color: var(--ash); padding-top: 18vh; }
.empty .stat { color: var(--porcelain); margin-bottom: 8px; }
.compose { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.compose form { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.compose textarea { max-height: 180px; }
.compose .btn { width: 44px; padding: 0; flex: none; }
.menu-btn { display: none; background: none; border: 0; color: var(--porcelain); font-size: 22px; width: 44px; height: 44px; cursor: pointer; }
@media (max-width: 760px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: block; }
  .meter { width: 64px; }
}
.shade { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 15; }

/* tables (admin) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--ash); font-weight: 500; padding: 8px; }
.tbl td { padding: 8px; border-top: 1px solid var(--steel); vertical-align: top; }
.scroll { overflow-x: auto; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form2 { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.slipimg { max-width: 100%; max-height: 70vh; border-radius: 14px; }
.qr { width: 220px; border-radius: 20px; background: #fff; padding: 12px; }

/* ---------- v2: markdown ---------- */
.msg .b .h { font: 600 17px/1.35 var(--display); margin: 16px 0 8px; }
.msg .b .h1 { font-size: 22px; } .msg .b .h2 { font-size: 19px; }
.msg .b ul, .msg .b ol { margin: 0 0 10px; padding-left: 22px; }
.msg .b li { margin: 3px 0; } .msg .b li.sub { margin-left: 18px; list-style: circle; }
.msg .b blockquote { margin: 0 0 10px; padding: 4px 14px; border-left: 3px solid var(--slate); color: var(--ash); }
.msg .b hr { border: 0; border-top: 1px solid var(--steel); margin: 16px 0; }
.msg .b a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.tw { overflow-x: auto; margin: 0 0 12px; -webkit-overflow-scrolling: touch; }
.tw table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.tw th, .tw td { padding: 8px 12px; border-bottom: 1px solid var(--steel); text-align: left; white-space: nowrap; }
.tw th { color: var(--ash); font-weight: 500; }
.code { background: #111114; border: 1px solid var(--hair); border-radius: 16px; margin: 0 0 12px; overflow: hidden; }
.code-h { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; font-size: 12px; color: var(--ash); border-bottom: 1px solid var(--steel); }
.code pre { margin: 0; border-radius: 0; }
.code-h button, .acts button { background: none; border: 0; color: var(--ash); font: 500 12px var(--font); padding: 8px 10px; border-radius: 10px; cursor: pointer; min-height: 32px; }
.code-h button:hover, .acts button:hover { background: var(--steel); color: var(--porcelain); }
.acts { display: flex; align-items: center; gap: 2px; margin-top: 4px; font-size: 12px; }
.acts .muted { font-size: 12px; margin-right: 6px; }

/* ---------- v2: chat UI ---------- */
.dots { display: inline-flex; gap: 5px; padding: 8px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ash); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 24px; padding: 0 16px; }
.chips button { min-height: 40px; padding: 0 16px; border-radius: 9999px; border: 1px solid var(--steel); background: var(--carbon); color: var(--porcelain); font: 400 14px var(--font); cursor: pointer; }
.notice { max-width: 760px; margin: 0 auto 8px; padding: 10px 16px; border-radius: 20px; background: var(--carbon); font-size: 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notice.hi { color: var(--yellow); } .notice.full { color: var(--red); }
.compose .err { max-width: 760px; margin: 0 auto 6px; min-height: 0; }
.compose .err:empty { display: none; }
.thumbs { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; }
.thumbs:not(:empty) { margin-bottom: 8px; }
.thumb { position: relative; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 14px; display: block; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--steel); color: var(--porcelain); font-size: 11px; cursor: pointer; }
.mimgs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.mimgs img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--slate); background: transparent; color: var(--porcelain); font-size: 20px; cursor: pointer; }
.btn.send.stop { background: var(--porcelain); color: var(--on-porcelain); }
.bar #effort { max-width: 110px; }
.side .item button { opacity: .6; } .side .item:hover button, .side .item.on button { opacity: 1; }

/* ---------- v2: plans + landing ---------- */
.tile.plan { position: relative; cursor: pointer; }
.tile.feat { box-shadow: 0 0 0 1px var(--slate) inset; }
.tile.sel { box-shadow: 0 0 0 2px var(--porcelain) inset; }
.badge { position: absolute; top: 20px; right: 20px; font: 600 12px var(--font); color: var(--on-porcelain); background: var(--porcelain); padding: 4px 10px; border-radius: 9999px; }
.feat-list { list-style: none; padding: 0; margin: 4px 0 0; font-size: 14px; }
.feat-list li { padding: 4px 0; border-top: 1px solid var(--steel); }
.cmp td:first-child { color: var(--ash); }
.faq { background: var(--obsidian); border-radius: 20px; padding: 0 20px; margin-bottom: 8px; }
.faq summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; font-weight: 500; list-style: none; }
.faq summary::after { content: '+'; margin-left: auto; color: var(--ash); font-size: 20px; transition: transform .2s; }
.faq[open] summary::after { transform: rotate(45deg); }
.faq p { margin: 0 0 16px; color: var(--ash); }
.bad { color: var(--red); }

/* ---------- v2: motion ---------- */
.view { animation: fadeUp .18s ease-out backwards; }
.msg.new { animation: fadeUp .22s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.btn, .tabs button, .chips button, .icon-btn, .tile.plan { transition: transform .15s ease, background-color .2s, color .2s, box-shadow .2s, opacity .2s; }
.btn:active, .tabs button:active, .chips button:active, .icon-btn:active { transform: scale(.96); }
.tile.plan:active { transform: scale(.98); }
.meter .fill { transition: width .5s ease, background-color .3s; }
.notice:not(:empty) { animation: fadeUp .25s ease-out both; }
.shade { animation: fade .2s ease-out both; }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.bar #model { flex: 0 1 auto; min-width: 0; max-width: 46%; }
@media (max-width: 760px) {
  .bar { gap: 6px; padding: 8px; }
  .bar select { padding: 4px 10px; font-size: 13px; }
  .bar #effort { max-width: 84px; }
  .meters { gap: 8px; }
  .meter { width: 52px; font-size: 10px; white-space: nowrap; }
}
.wrap > .grid > .tile { background: var(--carbon); } /* การ์ดบนพื้นดำ ใช้สี Carbon */
.cmp td:first-child, .cmp th:first-child { position: sticky; left: 0; background: var(--carbon); }
.legal .tile { margin-bottom: 12px; }
.legal h2 { text-align: left; font-size: 24px; }
.band.legal { background: var(--carbon); }
.tabs a { min-height: 36px; padding: 0 16px; border-radius: 9999px; border: 1px solid var(--steel); color: var(--porcelain); font: 500 14px var(--font); display: inline-flex; align-items: center; transition: transform .15s, background-color .2s; }
.tabs a.on { background: var(--porcelain); color: var(--on-porcelain); border-color: var(--porcelain); }
.tabs a:active { transform: scale(.96); }
.thumbs { flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; background: var(--carbon); border: 1px solid var(--steel); border-radius: 14px; padding: 6px 8px 6px 12px; font-size: 13px; }
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.fchip small { color: var(--ash); white-space: nowrap; }
.fchip button { background: none; border: 0; color: var(--ash); width: 28px; height: 28px; cursor: pointer; }
.mfiles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg.user .fchip { background: var(--obsidian); }
.compose.drop { outline: 2px dashed var(--slate); outline-offset: -6px; border-radius: 20px; }

/* ---------- โหมด Code ---------- */
.nav { overflow-x: auto; scrollbar-width: none; } .nav::-webkit-scrollbar { display: none; }
.nav a.l { white-space: nowrap; }
.tile.proj { gap: 4px; }
.ide { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--obsidian); }
.ide-bar { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid #282828; background: var(--graphite); }
.ide-bar .pname { font: 600 17px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.icon-btn.sm { width: 36px; height: 36px; font-size: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--porcelain); }
#ide-status { font-size: 12px; white-space: nowrap; } #ide-status.bad { color: var(--red); }
.ide-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr) 380px; }
.ide-files, .ide-ai { min-height: 0; display: flex; flex-direction: column; background: var(--graphite); }
.ide-files { border-right: 1px solid #282828; }
.ide-ai { border-left: 1px solid #282828; }
.ftools { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid #282828; }
.ftools .btn.sm { min-height: 32px; padding: 0 10px; font-size: 12px; }
.tree { flex: 1; overflow: auto; padding: 6px 4px 24px; font-size: 14px; }
.trow { display: flex; align-items: center; border-radius: 10px; }
.trow:hover { background: var(--carbon); }
.tname { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--porcelain); font: 400 14px var(--font); padding: 8px 4px; min-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.tname.on { color: var(--link); font-weight: 500; }
.tmore { background: none; border: 0; color: var(--ash); width: 36px; height: 36px; cursor: pointer; flex: none; }
.tmenu { display: flex; flex-direction: column; margin: 2px 8px 6px 24px; background: var(--carbon); border-radius: 14px; overflow: hidden; animation: fadeUp .15s ease-out both; }
.tmenu button { background: none; border: 0; border-bottom: 1px solid var(--steel); color: var(--porcelain); text-align: left; padding: 10px 14px; font: 400 14px var(--font); cursor: pointer; }
.tmenu button:last-child { border-bottom: 0; } .tmenu button.bad { color: var(--red); }
.ide-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.ide-tabs { display: flex; overflow-x: auto; flex: none; background: var(--graphite); border-bottom: 1px solid #282828; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 2px; padding-left: 12px; font-size: 13px; color: var(--ash); border-right: 1px solid #282828; cursor: pointer; white-space: nowrap; flex: none; }
.tab.on { color: var(--porcelain); background: #000; }
.tab button { background: none; border: 0; color: inherit; width: 32px; height: 36px; cursor: pointer; }
.ide-tools { display: flex; gap: 2px; padding: 4px 6px; flex: none; border-bottom: 1px solid #1a1a1a; overflow-x: auto; }
.ide-tools button, .run-h button { background: none; border: 0; color: var(--ash); font: 500 12px var(--font); padding: 0 10px; min-height: 32px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.ide-tools button:hover, .run-h button:hover { background: var(--carbon); color: var(--porcelain); }
.ide-editor { flex: 1; min-height: 0; overflow: hidden; }
.ide-editor .cm-editor { height: 100%; }
.ide-run { display: none; flex-direction: column; height: 42%; min-height: 160px; border-top: 1px solid #282828; background: var(--graphite); }
.ide[data-run="1"] .ide-run { display: flex; }
.run-h { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid #282828; flex: none; }
.run-h button.on { color: var(--porcelain); background: var(--carbon); }
.run-h button.alert::after { content: ' •'; color: var(--red); }
#run-status { font-size: 12px; margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-out { flex: 1; min-height: 0; background: #fff; }
.run-out iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.run-out:has(p) { background: var(--graphite); }
.console { flex: 1; min-height: 0; overflow: auto; font: 12.5px/1.5 ui-monospace, Menlo, monospace; padding: 8px 12px; white-space: pre-wrap; word-break: break-word; }
.cl { padding: 2px 0; border-bottom: 1px solid #161616; }
.cl.error { color: var(--red); } .cl.warn { color: var(--yellow); } .cl.info { color: var(--ash); }
.ai-h { display: flex; gap: 6px; padding: 10px 12px 6px; align-items: center; }
.ai-h select { min-height: 34px; padding: 2px 10px; font-size: 13px; width: auto; min-width: 0; flex: 1; }
.ai-h #ceffort { flex: 0 1 90px; }
.ide-ai .msgs { flex: 1; min-height: 0; padding: 12px; }
.ide-ai .msg { font-size: 14px; }
.ide-ai .compose { padding: 8px 10px 10px; }
.ide-ai .compose form { display: flex; gap: 8px; align-items: flex-end; }
.ctx { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 12px; }
.ctx .fchip { padding: 4px 4px 4px 10px; font-size: 12px; } .ctx .fchip span { max-width: 140px; }
.ctx select { width: auto; min-height: 30px; padding: 2px 10px; font-size: 12px; }
.changes { margin: 6px 0 4px; background: var(--carbon); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.chg { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 13px; flex-wrap: wrap; }
.cpath { flex: 1; min-width: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.chg button { background: none; border: 1px solid var(--slate); color: var(--porcelain); border-radius: 9999px; padding: 4px 12px; min-height: 30px; font: 500 12px var(--font); cursor: pointer; }
.chg button.ap { background: var(--blue); border-color: var(--blue); color: #fff; }
.changes > .btn { align-self: flex-start; margin: 4px 6px; }
.diffbox { position: fixed; inset: 5vh 3vw; z-index: 40; background: var(--graphite); border-radius: 20px; display: flex; flex-direction: column; box-shadow: 0 0 0 1px #333336; animation: fadeUp .2s ease-out both; overflow: hidden; }
.diff-h { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #282828; font-size: 13px; flex-wrap: wrap; }
.diff-b { flex: 1; overflow: auto; font: 12.5px/1.5 ui-monospace, Menlo, monospace; padding: 8px 0; }
.dl { white-space: pre-wrap; word-break: break-word; padding: 0 12px 0 0; display: flex; }
.dl span { width: 24px; flex: none; text-align: center; color: var(--ash); user-select: none; }
.dl.add { background: rgba(48, 209, 88, .14); } .dl.add span { color: var(--green); }
.dl.del { background: rgba(255, 69, 58, .14); } .dl.del span { color: var(--red); }
.ide-nav { display: none; }
@media (max-width: 999px) {
  .ide-body { grid-template-columns: minmax(0, 1fr); }
  .ide-files, .ide-ai, .ide-main { display: none; }
  .ide[data-pane="files"] .ide-files, .ide[data-pane="ai"] .ide-ai { display: flex; border: 0; }
  .ide[data-pane="code"] .ide-main, .ide[data-pane="run"] .ide-main { display: flex; }
  .ide[data-pane="run"] .ide-tabs, .ide[data-pane="run"] .ide-tools, .ide[data-pane="run"] .ide-editor { display: none; }
  .ide[data-pane="run"] .ide-run { display: flex; height: auto; flex: 1; border: 0; }
  .ide[data-pane="code"] .ide-run { display: none; }
  .ide-nav { display: flex; flex: none; border-top: 1px solid #282828; background: var(--graphite); padding-bottom: env(safe-area-inset-bottom); }
  .ide-nav button { flex: 1; background: none; border: 0; color: var(--ash); font: 500 11px var(--font); min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
  .ide-nav button span { font-size: 18px; } .ide-nav button.on { color: var(--porcelain); }
  .ide-bar .pname { max-width: 34vw; }
  #ide-status { display: none; }
  .ide-tools { order: 3; border-top: 1px solid #1a1a1a; border-bottom: 0; }
}
@media (min-width: 1000px) and (max-width: 1279px) { .ide-body { grid-template-columns: 200px minmax(0, 1fr) 320px; } }

/* ---------- Thinking ---------- */
.think { margin: 0 0 8px; max-width: 760px; }
.think summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ash); font-size: 13px; padding: 6px 12px 6px 10px; border-radius: 9999px; border: 1px solid var(--steel); min-height: 32px; user-select: none; }
.think summary::-webkit-details-marker { display: none; }
.think summary::before { content: '✦'; font-size: 11px; }
.think summary::after { content: '⌄'; font-size: 14px; line-height: 1; transition: transform .2s; margin-top: -4px; }
.think[open] summary::after { transform: rotate(180deg); margin-top: 4px; }
.think-b { margin-top: 8px; padding: 10px 14px; border-left: 2px solid var(--steel); color: var(--ash); font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; max-height: 320px; overflow: auto; animation: fadeUp .2s ease-out both; }
.shimmer { background: linear-gradient(90deg, var(--ash) 0%, var(--porcelain) 50%, var(--ash) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- หลังบ้าน ---------- */
.adm { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; min-height: calc(100dvh - 52px); }
.adm-nav { position: sticky; top: 52px; align-self: start; display: flex; flex-direction: column; gap: 2px; padding: 24px 12px; }
.adm-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 12px; color: var(--ash); font: 500 15px var(--font); transition: background-color .2s, color .2s; }
.adm-nav a:hover { color: var(--porcelain); background: var(--graphite); }
.adm-nav a.on { color: var(--porcelain); background: var(--carbon); }
.adm-nav .ai { width: 20px; text-align: center; }
.cnt { margin-left: auto; background: var(--red); color: #fff; font: 600 11px var(--font); min-width: 20px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.adm-main { padding: 24px 20px 64px; min-width: 0; }
.adm-h { font: 600 32px/1.15 var(--display); margin: 0 0 20px; }
@media (max-width: 860px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; gap: 6px; background: rgba(0,0,0,.85); backdrop-filter: blur(20px); z-index: 5; border-bottom: 1px solid #1a1a1a; scrollbar-width: none; }
  .adm-nav a { white-space: nowrap; min-height: 38px; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--steel); font-size: 14px; }
  .adm-nav a.on { background: var(--porcelain); color: var(--on-porcelain); border-color: var(--porcelain); }
  .adm-nav .ai { display: none; }
  .adm-main { padding: 16px 12px 48px; } .adm-h { font-size: 26px; margin-bottom: 14px; }
}
.seg { display: inline-flex; background: var(--carbon); border-radius: 9999px; padding: 3px; gap: 2px; margin-bottom: 16px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; color: var(--ash); font: 500 13px var(--font); min-height: 34px; padding: 0 14px; border-radius: 9999px; cursor: pointer; white-space: nowrap; transition: background-color .2s, color .2s; }
.seg button.on { background: var(--porcelain); color: var(--on-porcelain); }
.alert-row { display: flex; align-items: center; gap: 8px; background: var(--carbon); color: var(--yellow); border-radius: 16px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.alert-row span { margin-left: auto; color: var(--link); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis.sm { grid-template-columns: repeat(2, 1fr); }
.kpi { background: var(--carbon); border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .stat { font: 600 26px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .kd { font-size: 12px; }
.bar1 { height: 4px; border-radius: 4px; background: var(--steel); overflow: hidden; } .bar1 div { height: 100%; background: var(--porcelain); }
.panel { background: var(--carbon); border-radius: 24px; padding: 18px 18px 14px; margin-bottom: 16px; min-width: 0; }
.panel h2 { font: 600 17px var(--display); margin: 0; }
.ph { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.ph .muted { margin-left: auto; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.two .panel { margin-bottom: 0; } .two + .panel { margin-top: 16px; }
@media (max-width: 400px) { .two { grid-template-columns: minmax(0, 1fr); } }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ash); margin-left: auto; flex-wrap: wrap; }
.legend i, .ctip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; overflow: hidden; touch-action: pan-y; }
.chart svg { display: block; }
.chart .grid { stroke: #2c2c2e; stroke-width: 1; }
.chart .ax { fill: var(--ash); font: 11px var(--font); }
.chart .xh { stroke: var(--slate); stroke-width: 1; }
.chart path[data-i] { transition: opacity .15s; }
.ctip { position: fixed; z-index: 60; pointer-events: none; background: var(--porcelain); color: var(--on-porcelain); border-radius: 12px; padding: 8px 12px; font-size: 12px; line-height: 1.6; white-space: nowrap; }
.ctip b { font-weight: 600; }
.tview { margin-top: 6px; } .tview summary { cursor: pointer; color: var(--ash); font-size: 12px; min-height: 32px; display: flex; align-items: center; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hb { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto; align-items: center; gap: 12px; }
.hb-l { display: flex; flex-direction: column; min-width: 0; } .hb-l .muted { font-size: 12px; }
.hb-t { height: 10px; background: #2c2c2e; border-radius: 6px; overflow: hidden; } .hb-t div { height: 100%; background: #3987e5; border-radius: 6px; }
.hb-v { font: 600 14px var(--display); }
@media (max-width: 520px) { .hb { grid-template-columns: 1fr auto; } .hb-t { grid-column: 1 / -1; grid-row: 2; } }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #ffffff08; }
.pill { display: inline-flex; align-items: center; gap: 4px; font: 500 12px var(--font); padding: 3px 10px; border-radius: 9999px; background: var(--steel); color: var(--porcelain); white-space: nowrap; }
.pill.ok { background: rgba(48,209,88,.15); color: var(--green); } .pill.warn { background: rgba(255,213,0,.12); color: var(--yellow); } .pill.bad { background: rgba(255,69,58,.15); color: var(--red); }
.pay-card .row { gap: 10px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; font-size: 14px; }
.pay-grid .muted { font-size: 12px; }
.toolbar { margin-bottom: 12px; }
.urow { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--carbon); border: 0; color: var(--porcelain); border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font: inherit; transition: background-color .2s; }
.urow:hover { background: #2a2a2c; }
.av { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--steel); display: inline-flex; align-items: center; justify-content: center; font: 600 15px var(--display); }
.av.lg { width: 48px; height: 48px; font-size: 20px; }
.ue { flex: 1; min-width: 0; display: flex; flex-direction: column; } .ue b, .ue .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ue .muted { font-size: 12px; }
.ut { display: flex; flex-direction: column; align-items: flex-end; font: 600 15px var(--display); } .ut small { font: 400 11px var(--font); }
.chev { color: var(--ash); font-size: 20px; }
.empty-s { text-align: center; color: var(--ash); padding: 40px 0; }
.hint { margin: -8px 0 16px; }
.ed-list { display: flex; flex-direction: column; gap: 8px; }
.ed { background: var(--carbon); border-radius: 20px; overflow: hidden; }
.ed summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ed summary::-webkit-details-marker { display: none; }
.ed summary::after { content: '›'; margin-left: auto; color: var(--ash); font-size: 20px; transition: transform .2s; }
.ed[open] summary::after { transform: rotate(90deg); }
.ed summary .muted { font-size: 13px; width: 100%; order: 2; }
.ed.add summary b { color: var(--link); }
.ed-f { padding: 0 18px 18px; border-top: 1px solid var(--steel); }
.sw { position: relative; display: inline-block; width: 51px; height: 31px; margin: 4px 0 0; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: var(--steel); border-radius: 31px; cursor: pointer; transition: background-color .2s; }
.sw span::before { content: ''; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; }
.sw input:checked + span { background: var(--green); } .sw input:checked + span::before { transform: translateX(20px); }
.sw input:focus-visible + span { outline: 2px solid var(--porcelain); outline-offset: 2px; }
.chips-sel { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-sel label { margin: 0; } .chips-sel input { position: absolute; opacity: 0; }
.chips-sel span { display: inline-flex; min-height: 36px; align-items: center; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--steel); color: var(--porcelain); font-size: 13px; cursor: pointer; transition: background-color .2s, color .2s; }
.chips-sel input:checked + span { background: var(--porcelain); color: var(--on-porcelain); border-color: var(--porcelain); }
.chips-sel input:focus-visible + span { outline: 2px solid var(--porcelain); outline-offset: 2px; }
.form-p { max-width: 640px; } .form-p h2 { margin-bottom: 4px; }
.drawer { position: fixed; inset: 0; z-index: 50; }
.dr-shade { position: absolute; inset: 0; background: rgba(0,0,0,.6); animation: fade .2s ease-out both; }
.dr-p { position: absolute; right: 0; top: 0; bottom: 0; width: min(480px, 100vw); background: var(--graphite); padding: 20px; overflow: auto; animation: slideIn .25s ease-out both; box-shadow: -1px 0 0 #282828; }
.dr-p h3 { font: 600 15px var(--display); margin: 22px 0 8px; color: var(--ash); }
.dr-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; } .dr-h b { word-break: break-all; }
.drawer.out .dr-p { animation: slideOut .2s ease-in both; } .drawer.out .dr-shade { opacity: 0; transition: opacity .2s; }
@keyframes slideIn { from { transform: translateX(100%); } } @keyframes slideOut { to { transform: translateX(100%); } }
.ai-h2 { display: flex; align-items: center; gap: 10px; padding: 0 12px 6px; }
.sw-l { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 auto; color: var(--ash); font-size: 13px; cursor: pointer; }
.sw-l .sw { margin: 0; transform: scale(.85); }
.mimgs.shot img { width: 100%; max-width: 280px; height: auto; object-fit: contain; border-radius: 12px; border: 1px solid var(--steel); }
.msg.user.auto .b { background: transparent; border: 1px dashed var(--steel); font-size: 13px; color: var(--ash); white-space: pre-wrap; }
.gitbox { inset: auto 0 0 0; max-height: 88dvh; border-radius: 24px 24px 0 0; background: var(--carbon); box-shadow: 0 0 0 1px var(--hair), 0 0 0 100vmax rgba(0,0,0,.45); } /* พื้นหลังมืดลงให้รู้ว่าเป็นหน้าต่างลอย */
.gitbox .diff-h { border-bottom-color: var(--hair); padding: 12px 16px; }
.gitbox .git-b .form2 { align-items: start; }
@media (min-width: 1000px) { .gitbox { inset: 8vh auto auto calc(50% - 280px); width: 560px; border-radius: 24px; max-height: 84vh; } }
.git-b { padding: 4px 16px 20px; overflow: auto; font-size: 14px; }
.git-b h3 { font: 600 17px var(--display); margin: 16px 0 6px; }
.steps { padding-left: 20px; color: var(--ash); line-height: 1.8; } .steps b { color: var(--porcelain); }
.gm-repo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.gstat { background: var(--obsidian); border-radius: 16px; padding: 4px 14px; margin: 12px 0; }
.gl { margin: 8px 0; font: 12.5px/1.7 ui-monospace, Menlo, monospace; } .gl b { font: 600 12px var(--font); color: var(--ash); display: block; }
.ga::before { content: 'A  '; color: var(--green); } .gmo::before { content: 'M  '; color: var(--yellow); } .gd::before { content: 'D  '; color: var(--red); }
.gcommit { display: flex; flex-direction: column; gap: 8px; } .gcommit label { margin: 0 0 0 8px; }
.linkb { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; }
.clone summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 32px; }
.clone summary::-webkit-details-marker { display: none; }
.side-links { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid #1f1f1f; padding-top: 8px; }
.side-links a { color: var(--porcelain); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.side-links a:hover { background: var(--carbon); }

/* ---------- หน้าราคา ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pc { background: var(--carbon); border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.pc-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .pc-h b { font: 600 21px var(--display); }
.pc-tags { display: flex; gap: 6px; margin-left: auto; }
.pc p { margin: 0; font-size: 14px; }
.pc-rows { background: var(--obsidian); border-radius: 18px; padding: 4px 16px; }
.pc-rows div { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid #1f1f21; }
.pc-rows div:last-child { border-bottom: 0; }
.pc-rows span { color: var(--ash); font-size: 14px; } .pc-rows b { font: 600 19px var(--display); }
.pc-f { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.calc .form2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.calc-r { margin-top: 16px; } .calc-r .kpis { grid-template-columns: repeat(2, 1fr); }
.calc-r .kpi { background: var(--carbon); }

/* ---------- v6: บัญชี, wallet, แชตเพิ่มเติม, หน้าใหม่ ---------- */
.sp { flex: 1; }
.btn.danger, .btn.out.danger { color: var(--red); box-shadow: 0 0 0 1px var(--steel) inset; }
a.tile.link { color: var(--porcelain); transition: background-color .2s; }
a.tile.link:hover { background: #0b0b0c; }
.foot { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding: 48px 0; margin-top: 48px; border-top: 1px solid #282828; font-size: 13px; }
.foot div { display: flex; flex-direction: column; gap: 8px; }
.foot a { color: var(--ash); } .foot a:hover { color: var(--porcelain); }
.foot p { grid-column: 1 / -1; margin: 0; }
/* ประกาศ */
.ann { position: fixed; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30; max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: center; padding: 10px 10px 10px 18px; border-radius: 20px; background: var(--carbon); box-shadow: 0 0 0 1px var(--steel); font-size: 14px; animation: rise .3s ease; }
.ann span { flex: 1; } .ann.warn { box-shadow: 0 0 0 1px var(--yellow); } .ann.critical { box-shadow: 0 0 0 1px var(--red); }
.ann button { background: none; border: 0; color: var(--ash); width: 36px; height: 36px; cursor: pointer; flex: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
/* ล็อกอินด้วย Google/LINE */
.social { display: flex; flex-direction: column; gap: 8px; }
.social .btn { width: 100%; }
.social .btn.line { box-shadow: 0 0 0 1px #06c755 inset; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ash); font-size: 12px; margin: 8px 0 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--steel); }
/* สวิตช์ */
.tg { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0; cursor: pointer; color: var(--porcelain); font-size: 15px; }
.tg input { appearance: none; width: 44px; height: 26px; border-radius: 26px; background: var(--steel); position: relative; flex: none; cursor: pointer; transition: background-color .2s; margin: 0; padding: 0; border: 0; }
.tg input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.tg input:checked { background: var(--green); } .tg input:checked::after { transform: translateX(18px); }
.tg span { display: flex; flex-direction: column; gap: 2px; }
.mem { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; background: var(--obsidian); border-radius: 14px; margin-bottom: 6px; font-size: 14px; }
.mem span { flex: 1; } .mem button { background: none; border: 0; color: var(--ash); width: 32px; height: 32px; cursor: pointer; }
.qrbox { background: #fff; border-radius: 14px; padding: 8px; width: 180px; margin: 8px 0; } .qrbox svg { display: block; width: 100%; height: auto; }
textarea { border-radius: 20px; }
/* แชต: แถบเครื่องมือ, โฟลเดอร์, แหล่งที่มา, เทียบโมเดล */
.bar { overflow-x: auto; scrollbar-width: none; } .bar::-webkit-scrollbar { display: none; }
.bar > * { flex: none; } .bar .meters { margin-left: auto; }
.tbtn { min-height: 36px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--steel); background: transparent; color: var(--ash); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.tbtn.on { background: var(--porcelain); color: var(--on-porcelain); border-color: var(--porcelain); }
.side .folder summary { display: flex; align-items: center; gap: 4px; padding: 6px 0 6px 12px; cursor: pointer; list-style: none; font-size: 13px; color: var(--ash); border-radius: 10px; }
.side .folder summary span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .folder summary button { background: none; border: 0; color: var(--ash); width: 30px; height: 30px; cursor: pointer; opacity: 0; }
.side .folder summary:hover button, .side .folder summary:focus-within button { opacity: 1; }
@media (pointer: coarse) { .side .folder summary button { opacity: 1; } }
.side .folder .item { margin-left: 10px; }
.side .mvsel { position: absolute; right: 8px; width: 200px; min-height: 36px; padding: 4px 12px; font-size: 13px; z-index: 2; background: var(--carbon); }
.side .item { position: relative; }
.srcs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.srcs a { display: inline-flex; gap: 6px; align-items: center; max-width: 220px; padding: 4px 10px 4px 4px; border-radius: 9999px; background: var(--carbon); color: var(--ash); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srcs b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; background: var(--steel); color: var(--porcelain); font-size: 11px; }
.mnote { font-size: 12px; color: var(--yellow); margin-top: 6px; }
.msg.user { flex-wrap: wrap; } .msg.user .acts { width: 100%; justify-content: flex-end; opacity: 0; transition: opacity .2s; }
.msg.user:hover .acts, .msg.user:focus-within .acts { opacity: 1; }
@media (pointer: coarse) { .msg.user .acts { opacity: 1; } }
.msg img.gen { display: block; max-width: min(100%, 512px); border-radius: 20px; margin: 4px 0; }
.code-h .run-code { margin-right: 4px; }
/* หน้าต่างแสดงผล HTML */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 12px; }
.modal-b { width: min(100%, 1000px); height: min(100%, 760px); background: var(--carbon); border-radius: 28px; display: flex; flex-direction: column; overflow: hidden; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; }
.modal iframe { flex: 1; border: 0; background: #fff; }
/* บล็อก */
.post img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 18px; }
.post-body h1 { font: 600 40px/1.15 var(--display); letter-spacing: -.5px; margin: 16px 0 8px; }
.post-body .cover { width: 100%; border-radius: 28px; margin: 16px 0; }
.post-body .msg { max-width: none; font-size: 17px; }
/* ติดต่อเรา */
.thread { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.tmsg { background: var(--carbon); border-radius: 20px; padding: 12px 16px; max-width: 88%; align-self: flex-end; }
.tmsg.adm { align-self: flex-start; background: var(--graphite); box-shadow: 0 0 0 1px var(--steel); }
a.tk { color: var(--porcelain); padding: 12px 4px; border-top: 1px solid var(--steel); flex-wrap: nowrap; } a.tk span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* สถานะระบบ */
.st .bars { display: flex; gap: 2px; height: 32px; margin: 12px 0 4px; }
.st .bars i { flex: 1; border-radius: 3px; background: var(--steel); }
.st .bars i.good { background: var(--green); } .st .bars i.mid { background: var(--yellow); } .st .bars i.bad { background: var(--red); }
/* ใบเสร็จ */
.receipt { max-width: 760px; margin: 0 auto; padding: 24px 16px; }
.receipt .paper { background: #fff; color: #1d1d1f; border-radius: 28px; padding: 40px; }
.receipt .paper h1 { font: 600 24px var(--display); margin: 0; } .receipt .paper h2 { font: 600 20px var(--display); margin: 0; }
.receipt .paper p { margin: 6px 0; font-size: 14px; } .receipt .paper .row { align-items: flex-start; flex-wrap: nowrap; }
.receipt table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 14px; }
.receipt th { text-align: left; border-bottom: 2px solid #1d1d1f; padding: 8px 0; }
.receipt td { padding: 10px 0; border-bottom: 1px solid #d2d2d7; }
.receipt .tot td { font-weight: 600; font-size: 17px; border-bottom: 0; }
.receipt .muted { color: #6e6e73; }
/* พิมพ์: ใบเสร็จ และส่งออกแชตเป็น PDF */
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  .no-print, .nav, .ann, .foot { display: none !important; }
  .receipt { padding: 0; } .receipt .paper { border-radius: 0; padding: 0; }
  body.printing .side, body.printing .bar, body.printing .compose, body.printing .acts, body.printing .shade { display: none !important; }
  body.printing .chat, body.printing .main, body.printing .msgs { display: block !important; height: auto !important; overflow: visible !important; }
  body.printing .msg { color: #000; } body.printing .msg.user .b { background: #f2f2f2; color: #000; }
  body.printing pre, body.printing .think { background: #f5f5f5 !important; color: #000; }
}
.ver { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; background: var(--obsidian); border: 0; border-radius: 14px; padding: 10px 14px; margin-bottom: 6px; color: var(--porcelain); font: 400 14px var(--font); cursor: pointer; }
.ver:hover { background: #0b0b0c; }
.gbr { margin-top: 8px; } .gbr select { width: auto; min-height: 36px; padding: 4px 14px; font-size: 13px; }
#ghostb[aria-pressed=true] { color: var(--porcelain); }

.sw-row { display: flex; align-items: center; gap: 12px; color: var(--porcelain); font-size: 15px; margin: 12px 0; cursor: pointer; }
.sw-row .sw { margin: 0; flex: none; }
.form2.one { grid-template-columns: 1fr; }
.envs { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); font-size: 14px; }
.envs code { font-size: 11px; color: var(--ash); }
.bar #model { flex: none; max-width: 170px; }
.btn { white-space: nowrap; }
.card .ed.key { background: var(--obsidian); margin-bottom: 8px; }
.kset { padding: 0 18px 18px; }
/* โปรลดราคาในหน้าราคา */
.pill.sale { background: rgba(255,69,58,.15); color: var(--red); }
.pc.promo { box-shadow: 0 0 0 1px rgba(255,69,58,.35); }
.sale-t { color: var(--red); font-size: 13px; margin: 4px 0 0; }
.pc-rows s { font-weight: 400; font-size: .85em; }

/* ---------- แชตแบบ Codex / Claude Code มือถือ ---------- */
.chat .bar { gap: 6px; padding: 6px 8px; overflow: visible; }
.chat .bar .menu-btn { display: none; }
.ctitle { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding-left: 8px; }
.ctitle b { font: 600 15px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctitle small { font-size: 11px; color: var(--ash); }
.ctitle small:empty { display: none; }
.lim { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--steel); background: transparent; color: var(--ash); font: 500 12px var(--font); cursor: pointer; flex: none; }
.ring { width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(var(--porcelain) calc(var(--p) * 1%), var(--steel) 0); }
.ring.hi { background: conic-gradient(var(--yellow) calc(var(--p) * 1%), var(--steel) 0); } .ring.full { background: conic-gradient(var(--red) calc(var(--p) * 1%), var(--steel) 0); }
.chat .bar .icon-btn.sm { border-color: var(--steel); font-size: 16px; }
.compose .cbox { display: block; max-width: 760px; margin: 0 auto; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border: 1px solid var(--hair); border-radius: 24px; padding: 6px 8px 8px; box-shadow: 0 8px 28px rgba(0,0,0,.45), inset 0 1px 0 rgba(var(--ov), .06); }
.compose .cbox:focus-within { border-color: var(--slate); }
.cbox textarea { display: block; border: 0; background: transparent; padding: 10px 10px 6px; min-height: 44px; max-height: 180px; outline: none; font-size: 16px; }
.crow { display: flex; align-items: center; gap: 6px; }
.crow .sp { flex: 1; }
.cb { min-height: 36px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--steel); background: var(--obsidian); color: var(--porcelain); font: 500 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; flex: none; transition: transform .15s, background-color .2s; }
.cb:active, .lim:active, .flag:active { transform: scale(.96); }
#plus { width: 36px; padding: 0; justify-content: center; font-size: 18px; }
.cb.pick { min-width: 0; max-width: 46vw; flex: 0 1 auto; }
.cb.pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#flags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 8px; } #flags:empty { display: none; } /* ป้ายโหมด (สร้างภาพ ปรับ prompt ฯลฯ) อยู่เหนือช่องพิมพ์ ไม่ทับข้อความ */
.flag { min-height: 30px; padding: 0 10px; border-radius: 9999px; border: 0; background: rgba(75, 79, 224,.15); color: var(--link); font: 500 12px var(--font); cursor: pointer; white-space: nowrap; flex: none; }
.cbox .send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--porcelain); color: var(--on-porcelain); font: 600 18px var(--font); cursor: pointer; flex: none; transition: transform .15s, opacity .2s; }
.cbox .send.stop { background: var(--red); color: #fff; font-size: 13px; }
.cbox .send:active { transform: scale(.92); }
@media (max-width: 760px) {
  .chat .bar .menu-btn { display: block; width: 40px; height: 40px; }
  .ctitle { padding-left: 0; }
  .crow { gap: 4px; } .cb { padding: 0 10px; font-size: 12px; }
  .cb.pick { max-width: 40vw; }
}
/* แผ่นเลือกจากด้านล่าง */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease-out both; }
.sheet { width: 100%; max-width: 520px; max-height: 80dvh; overflow: auto; background: rgba(var(--bg1), .92); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--hair); border-radius: 28px 28px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.6); animation: up .25s cubic-bezier(.2,.8,.2,1) both; }
@media (min-width: 761px) { .sheet-bg { align-items: center; } .sheet { border-radius: 28px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-h { display: flex; align-items: center; padding: 8px 8px 12px; }
.sheet-h b { flex: 1; font: 600 17px var(--display); }
.sheet-h .x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--steel); color: var(--porcelain); cursor: pointer; }
.opt { width: 100%; display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 2px 8px; padding: 12px 14px; margin-bottom: 4px; border: 0; border-radius: 16px; background: var(--obsidian); color: var(--porcelain); cursor: pointer; font: inherit; min-height: 52px; }
.opt.on { box-shadow: 0 0 0 2px var(--porcelain) inset; }
.opt-t { font: 500 15px var(--font); } .opt-d { grid-column: 1; font-size: 12px; color: var(--ash); }
.opt i { grid-row: 1 / 3; grid-column: 2; align-self: center; font-style: normal; }
.opt-more { display: block; text-align: center; padding: 12px; font-size: 14px; }
.meters.big { flex-direction: column; gap: 14px; } .meters.big .meter { width: 100%; font-size: 13px; } .meters.big .track { height: 6px; }
/* token ใต้คำตอบ */
.acts .tok { margin-left: auto; color: var(--ash); font-size: 11px; white-space: nowrap; }
/* คำถามแบบเลือกตอบ (จาก JSON ของโมเดล) */
.ask { background: var(--carbon); border: 1px solid var(--steel); border-radius: 20px; padding: 12px 14px; margin: 8px 0; }
.ask-q { font-weight: 500; margin-bottom: 8px; }
.ask-o { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-o button { min-height: 36px; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--slate); background: transparent; color: var(--porcelain); font: 400 14px var(--font); cursor: pointer; text-align: left; }
.ask-o button:disabled { opacity: .5; cursor: default; }
.btn.loading { opacity: .6; pointer-events: none; }
.crow { flex-wrap: wrap; row-gap: 6px; } .cb, .flag { white-space: nowrap; }
.crow .send { margin-left: auto; }
#app:has(.chat) .ann { top: calc(60px + env(safe-area-inset-top)); bottom: auto; } /* แชต: ช่องพิมพ์สูงขึ้น จึงย้ายประกาศขึ้นบน */
.side-links { display: grid; grid-template-columns: 1fr 1fr; } .side-links a { padding: 8px 12px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ไอคอน SVG (Lucide) */
.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }
.ic.sm { width: .95em; height: .95em; }
.stat .ic { width: 32px; height: 32px; stroke-width: 1.75; }
.menu-btn .ic, .icon-btn .ic { width: 20px; height: 20px; }
.cbox .send .ic { width: 18px; height: 18px; stroke-width: 2.5; vertical-align: middle; }
.side .item button .ic, .side .folder summary button .ic { width: 16px; height: 16px; }
.side-links a .ic { margin-right: 4px; color: var(--ash); }
.opt-t .ic { margin-right: 8px; color: var(--ash); }
.opt.on .opt-t .ic { color: var(--porcelain); }
.adm-nav .ai .ic { width: 18px; height: 18px; }
.flag { display: inline-flex; align-items: center; gap: 4px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; } .menu-btn .ic { display: block; margin: auto; }
.ic.f-html, .ic.f-htm { color: #ff8a4c; } .ic.f-css { color: #5ac8fa; } .ic.f-js, .ic.f-mjs, .ic.f-jsx { color: #ffd60a; } .ic.f-ts, .ic.f-tsx { color: #2997ff; } .ic.f-py { color: #30d158; } .ic.f-json { color: #bf5af2; }
.tool { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0; padding: 4px 10px; border-radius: 9999px; background: var(--carbon); color: var(--ash); font-size: 12px; max-width: 100%; }
.tool code { background: none !important; padding: 0 !important; color: var(--porcelain); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.think summary::before, .think summary::after { content: none; }
.think summary .chev { transition: transform .2s; } .think[open] summary .chev { transform: rotate(180deg); }
/* เทอร์มินัล */
.term { display: flex; flex-direction: column; flex: 1; min-height: 0; background: #000; }
.term pre { flex: 1; margin: 0; padding: 12px; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; color: var(--porcelain); }
.term pre .err { color: var(--red); } .term pre .cmd { color: var(--link); } .term pre .muted { color: var(--ash); }
.term form { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--steel); font: 13px ui-monospace, Menlo, monospace; color: var(--green); }
.term input { min-height: 36px; border: 0; background: transparent; padding: 0; font: 14px ui-monospace, Menlo, monospace; border-radius: 0; }
.changes.runs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.changes.runs code { background: #000; padding: 4px 8px; border-radius: 8px; font-size: 12px; }
.changes.runs { flex-direction: row; justify-content: flex-start; text-align: left; }
/* โหมด Code: แผง AI แบบเดียวกับหน้าแชต */
.ai-h .sp { flex: 1; }
.ai-t { display: inline-flex; align-items: center; gap: 6px; font: 600 15px var(--font); }
.ide-ai .compose .cbox { display: block; }
.ide-ai .cbox textarea { font-size: 15px; }
.ide-ai .ctx:empty { display: none; }
/* ไฟล์ที่ AI ทำให้ดาวน์โหลด */
.code.file { box-shadow: 0 0 0 1px var(--slate); }
.code-h .fname { display: inline-flex; align-items: center; gap: 6px; color: var(--porcelain); font-weight: 500; margin-right: auto; }
.code-h .dl-code.main { background: var(--blue); color: #fff; }
.code-h .dl-code.main:hover { background: #0077ed; color: #fff; }
.code-h { justify-content: flex-start; gap: 2px; } .code-h > span:first-child { margin-right: auto; } .code-h .dl-code { display: inline-flex; align-items: center; gap: 4px; }
.code-h .dl-code { flex: none; width: auto; white-space: nowrap; flex-direction: row; } .code-h .dl-code.main { padding: 6px 14px; border-radius: 9999px; }
.ed.gift { margin-bottom: 12px; } .ed.gift summary .ic { margin-right: 6px; }

.ubars{display:flex;gap:4px;align-items:flex-end;height:96px;margin-bottom:12px}
.ubar{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:4px;font-size:10px;color:var(--ash,#86868b)}
.ubar i{display:block;width:100%;background:#f5f5f7;border-radius:4px 4px 0 0;min-height:2px}

/* ---------- UI Upgrade: Glass Showcase, Toast, Scroll FAB, Syntax Highlight ---------- */
.hero { position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -120px; left: 50%; transform: translateX(-50%); width: 680px; height: 340px; background: radial-gradient(ellipse at center, rgba(75, 79, 224,.22), rgba(75, 79, 224,.06) 50%, transparent 72%); pointer-events: none; z-index: 0; }
.hero > * { position: relative; z-index: 1; }
.showcase { max-width: 780px; margin: 36px auto 0; text-align: left; background: linear-gradient(180deg, rgba(28,28,34,.85), rgba(14,14,17,.92)); border: 1px solid rgba(var(--ov), .12); border-radius: 26px; padding: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.65), inset 0 1px 0 rgba(var(--ov), .1); backdrop-filter: blur(20px); }
.sc-bar { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--hair); margin-bottom: 14px; font-size: 12px; color: var(--ash); }
.sc-dots { display: flex; gap: 6px; margin-right: 6px; }
.sc-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--steel); display: block; }
.sc-pill { background: rgba(var(--ov), .06); border: 1px solid var(--hair); color: var(--porcelain); padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500; }
.sc-chat { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.sc-u { align-self: flex-end; background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 18px 18px 4px 18px; max-width: 82%; }
.sc-a { background: rgba(var(--ov), .03); border: 1px solid var(--hair); border-radius: 18px; padding: 12px 14px; }
.sc-a .code { margin: 8px 0 0; }

.toast { position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80; max-width: min(92vw, 440px); padding: 10px 18px; border-radius: 9999px; background: rgba(28,28,34,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(var(--ov), .14); color: var(--porcelain); font: 500 13.5px var(--font); box-shadow: 0 10px 30px rgba(0,0,0,.55); animation: fadeUp .2s ease-out both; pointer-events: none; text-align: center; }
.toast.ok { border-color: rgba(48,209,88,.45); color: var(--green); }
.toast.bad { border-color: rgba(255,69,58,.45); color: var(--red); }

.main { position: relative; }
.compose { position: relative; }
.scroll-fab { position: absolute; right: 16px; bottom: 100%; margin-bottom: 10px; z-index: 8; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(var(--ov), .14); background: rgba(var(--bg1), .88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: var(--porcelain); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.5); transition: transform .15s, opacity .2s; }
.scroll-fab:active { transform: scale(.92); }

.sheet-form { display: flex; flex-direction: column; gap: 12px; padding: 4px 4px 0; }
.sheet-msg { margin: 0; color: var(--ash); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.sheet-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.sheet-acts .btn { flex: 1; }

.tk-c { color: #565f89; font-style: italic; }
.tk-s { color: #9ece6a; }
.tk-k { color: #bb9af7; }
.tk-n { color: #2ac3de; }

.acts button { display: inline-flex; align-items: center; gap: 4px; }
.side .item button { flex: none; opacity: .7; }
@media (max-width: 999px) {
  .ide-tools { padding: 4px 6px; gap: 4px; }
  .ide-tools button { padding: 0 8px; font-size: 11.5px; }
}

/* ---------- Claude-style Dark Apple Sidebar ---------- */
.side { width: 290px; background: #0c0c0e; border-right: 1px solid var(--hair); padding: 14px 12px calc(12px + env(safe-area-inset-bottom)); gap: 6px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px; }
.side-top .logo { font: 700 17px var(--font); letter-spacing: .8px; } /* แถบข้างใช้ฟอนต์เดียวกับรายการแชต */
.icon-btn.ghost { border-color: transparent; background: transparent; color: var(--ash); }
.icon-btn.ghost:hover { background: rgba(var(--ov), .07); color: var(--porcelain); }
.icon-btn.xs { width: 28px; height: 28px; font-size: 16px; }
.side-search { padding: 0 2px 6px; animation: fadeUp .15s ease-out both; }
.side-search input { min-height: 38px; padding: 6px 12px; font-size: 14px; background: rgba(var(--ov), .05); border-color: var(--hair); }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--hair); }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--porcelain); font: 400 14px var(--font); transition: background-color .15s; }
.side-nav a:hover { background: rgba(var(--ov), .06); }
.side-nav a .ic { width: 16px; height: 16px; color: var(--ash); }
.side-sec { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 2px; font-size: 12px; font-weight: 600; color: var(--ash); letter-spacing: .2px; }
.side-foot { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--hair); margin-top: auto; }
.side-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 12px; color: var(--porcelain); }
.side-user:hover { background: rgba(var(--ov), .06); }
.av.sm { width: 34px; height: 34px; font-size: 14px; background: #2c2c32; border: 1px solid var(--hair); }
.su-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.su-t b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-t small { font-size: 11px; color: var(--ash); }
.btn-new-chat { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 9999px; background: var(--porcelain); color: var(--on-porcelain); font: 600 13.5px var(--font); white-space: nowrap; flex: none; transition: transform .15s, opacity .15s; }
.btn-new-chat:active { transform: scale(.96); }

/* ---------- Code Mode Enhancements ---------- */
.cl.error { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.cl.error span { flex: 1; min-width: 180px; }
.btn-fix { background: rgba(255,69,58,.18); border: 1px solid rgba(255,69,58,.4); color: var(--red); border-radius: 9999px; padding: 2px 10px; font: 500 11.5px var(--font); cursor: pointer; flex: none; }
.btn-fix:hover { background: rgba(255,69,58,.28); }
.mkeys { display: none; gap: 4px; padding: 6px 8px; background: var(--graphite); border-top: 1px solid var(--hair); overflow-x: auto; scrollbar-width: none; flex: none; }
.mkeys::-webkit-scrollbar { display: none; }
.mkeys button { min-width: 38px; min-height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--steel); background: var(--carbon); color: var(--porcelain); font: 500 13px ui-monospace, Menlo, monospace; flex: none; cursor: pointer; }
.mkeys button:active { transform: scale(.94); background: var(--steel); }
@media (pointer: coarse) { .mkeys { display: flex; } }
.sel-ai { position: absolute; right: 14px; bottom: 52px; z-index: 12; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid rgba(var(--ov), .16); background: rgba(var(--bg1), .92); backdrop-filter: blur(16px); color: var(--porcelain); font: 500 12.5px var(--font); cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.55); animation: fadeUp .15s ease-out both; }
.run-out.mob { display: flex; justify-content: center; background: #0c0c0e; padding: 12px; overflow: auto; }
.run-out.mob iframe { width: 375px; max-width: 100%; border-radius: 24px; border: 2px solid var(--steel); box-shadow: 0 12px 36px rgba(0,0,0,.6); }
.run-h button.on { color: var(--porcelain); background: var(--carbon); }
.ide.run-full .ide-run { position: fixed; inset: 0; z-index: 50; height: 100dvh; display: flex !important; }

.nav a.nav-acc { background: rgba(var(--ov), .07); border: 1px solid var(--hair); border-radius: 9999px; padding: 6px 12px; color: var(--porcelain); display: inline-flex; align-items: center; gap: 6px; }

.side-sub { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--ash); letter-spacing: .2px; }
#mic.rec { border-color: var(--red); color: var(--red); background: rgba(255,69,58,.15); animation: blink 1s infinite; }

/* ---------- Full-Text Search Hits & Artifacts Canvas ---------- */
.side .item.hit a { align-items: flex-start; padding: 8px 10px; }
.side .item.hit a span { display: flex; flex-direction: column; white-space: normal; line-height: 1.35; }
.side .item.hit a b { font-size: 13px; font-weight: 500; }
.side .item.hit a small { font-size: 11.5px; color: var(--ash); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.canvas { width: min(48vw, 620px); flex: none; background: #0c0c0e; border-left: 1px solid var(--hair); display: flex; flex-direction: column; animation: slideIn .2s ease-out both; }
.cv-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--hair); background: rgba(12,12,14,.85); backdrop-filter: blur(16px); }
.cv-h b { font: 600 15px var(--display); margin-right: 4px; }
.cv-b { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cv-b iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.cv-b pre { flex: 1; margin: 0; padding: 16px; overflow: auto; background: #050507; font: 13px/1.55 ui-monospace, Menlo, monospace; }
@media (max-width: 959px) { .canvas { position: fixed; inset: 0; width: 100%; z-index: 45; border-left: 0; } }

/* ---------- Tool Steps Sheet, Mermaid & Math ---------- */
.steps-bar { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 6px 12px; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .04); color: var(--ash); font: 500 12.5px var(--font); cursor: pointer; transition: background-color .15s, color .15s; }
.steps-bar:hover { background: rgba(var(--ov), .08); color: var(--porcelain); }
.step-tl { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.step-i { display: flex; align-items: flex-start; gap: 12px; }
.step-ic { width: 28px; height: 28px; border-radius: 50%; background: var(--obsidian); border: 1px solid var(--hair); display: inline-flex; align-items: center; justify-content: center; color: var(--ash); flex: none; }
.step-i div { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.step-i code { color: var(--ash); font-size: 12px; word-break: break-all; background: none; padding: 0; }
.mermaid-box { background: #0c0c0e; border: 1px solid var(--hair); border-radius: 16px; padding: 14px; margin: 0 0 12px; overflow-x: auto; text-align: center; }
.math-b { display: block; overflow-x: auto; padding: 8px 0; text-align: center; }


/* ---------- Liquid Glass on warm black: frosted capsules, specular edges, clay accent ---------- */
::selection { background: rgba(75, 79, 224, .4); color: #fff; }
html { background: var(--obsidian); scrollbar-color: var(--steel) var(--obsidian); }
input, textarea { caret-color: var(--blue); }
:focus-visible { outline-color: var(--link); }
.btn, .tabs button, .chips button, .icon-btn, .tile, a, .cb, .lim { transition: background-color .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1), border-color .35s ease, opacity .25s; }

/* the glass recipe: translucent fill, blur + saturate, bright top edge, soft drop */
.nav, .card, .tile, .showcase, .seg, .btn.out, .btn.dark, .tabs button, .chips button, .sc-pill, .lim, .toast {
  background-image: linear-gradient(135deg, rgba(var(--ov), .11), rgba(var(--ov), .03));
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(var(--ov), .14);
  box-shadow: inset 0 1px 0 rgba(var(--ov), .28), inset 0 -1px 0 rgba(var(--ov), .04), 0 8px 32px rgba(0, 0, 0, .3);
}
.nav { background-color: rgba(var(--bg0), .55); border-width: 0 0 1px; }
.card, .tile, .showcase { background-color: rgba(var(--bg2), .45); }
.btn.out, .btn.dark, .tabs button, .chips button, .sc-pill, .lim, .seg { background-color: rgba(var(--ov), .04); }
.btn.out { color: var(--porcelain); }
.btn.out:hover, .btn.dark:hover { background-color: rgba(var(--ov), .12); }
.btn.blue { background-color: rgba(var(--ov), .24); color: #fff; font-weight: 600; border: 1px solid rgba(var(--ov), .45); box-shadow: inset 0 1px 0 rgba(var(--ov), .55), 0 0 24px rgba(var(--ov), .12), 0 8px 32px rgba(0, 0, 0, .3); }
.btn.blue:hover { background-color: rgba(var(--ov), .32); transform: translateY(-1px); }
.btn:active, .tabs button:active { transform: scale(.97); }
.tabs button.on { background: var(--porcelain); color: var(--on-porcelain); }
.sc-u { background: rgba(var(--ov), .14); color: var(--porcelain); border: 1px solid rgba(var(--ov), .22); box-shadow: inset 0 1px 0 rgba(var(--ov), .3); }
.seg button.on { background: var(--porcelain); color: var(--on-porcelain); }
input, select, textarea { background: rgba(var(--ov), .05); border-color: rgba(var(--ov), .14); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--blue); }

/* home: warm ambient light behind the glass, serif display voice */
[data-page=home] { background: transparent; }
[data-page=home]::before { content: ''; position: fixed; inset: -10%; z-index: -1; pointer-events: none; background:
  radial-gradient(40vmax 40vmax at 15% 10%, rgba(75, 79, 224, .5), transparent 65%),
  radial-gradient(36vmax 36vmax at 88% 28%, rgba(120, 110, 200, .38), transparent 65%),
  radial-gradient(44vmax 44vmax at 45% 95%, rgba(222, 170, 120, .3), transparent 65%);
  animation: drift 28s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(3%, 4%, 0) scale(1.08); } }
[data-page=home] .hero { padding: 80px 16px 24px; --hx: 50%; --hy: 20%; }
[data-page=home] .hero::before { top: 0; left: 0; transform: none; width: 100%; height: 100%; background: radial-gradient(circle 260px at var(--hx) var(--hy), rgba(var(--ov), .1), transparent 70%); }
[data-page=home] .hero .name { font: 500 13px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--ash); }
[data-page=home] .hero h1, [data-page=home] .band h2, [data-page=home] .price { font-family: var(--display); font-weight: 500; }
[data-page=home] .hero h1 { font-size: 40px; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; margin: 16px 0 24px; }
[data-page=home] .hero p { color: #cfc6b8; text-wrap: pretty; }
[data-page=home] .hero .row { gap: 16px; flex-wrap: wrap; }
[data-page=home] .hero .btn { min-height: 52px; padding: 0 28px; font-size: 16px; }
@media (min-width: 768px) { [data-page=home] .hero h1 { font-size: 64px; } }
[data-page=home] .showcase { animation: sc-in .9s cubic-bezier(.16, 1, .3, 1) both; border-radius: 28px; }
@keyframes sc-in { from { opacity: .001; transform: translateY(24px); } to { opacity: 1; transform: none; } }

[data-page=home] .band { background: none; border: 0; box-shadow: none; margin: 0 0 56px; padding: 24px 0; }
[data-page=home] .band h2 { font-size: 32px; line-height: 1.3; margin-bottom: 32px; }
[data-page=home] #plans { margin-top: 48px; }
[data-page=home] .tile { position: relative; overflow: hidden; --mx: 50%; --my: 50%; }
[data-page=home] .tile::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s ease; background: radial-gradient(220px circle at var(--mx) var(--my), rgba(var(--ov), .18), transparent 65%); }
[data-page=home] .tile:hover::after { opacity: 1; }
[data-page=home] a.tile.link:hover { transform: translateY(-2px); background-color: rgba(var(--ov), .08); }
[data-page=home] .tile.plan.feat { border-color: rgba(var(--ov), .5); box-shadow: inset 0 1px 0 rgba(var(--ov), .45), 0 0 0 1px rgba(var(--ov), .25), 0 12px 40px rgba(var(--ov), .1); }
[data-page=home] .tile.plan.sel { box-shadow: inset 0 0 0 2px var(--porcelain); }
[data-page=home] .price, [data-page=home] .cmp { font-variant-numeric: tabular-nums; }
[data-page=home] .rv { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.16, 1, .3, 1); }
[data-page=home] .rv.in { opacity: 1; transform: none; }

[data-page=home] .facts .grid { grid-template-columns: 1fr; gap: 12px; }
[data-page=home] .facts .tile { flex-direction: row; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 20px; }
[data-page=home] .facts .stat { flex: none; min-width: 64px; font-size: 22px; color: var(--link); }
[data-page=home] .facts .muted { font-size: 15px; color: var(--porcelain); }
@media (min-width: 768px) {
  [data-page=home] .facts .grid { grid-template-columns: 1fr 1fr; }
  [data-page=home] #plans .grid, [data-page=home] .band:not(.facts):not(#plans) > .grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}
@media (max-width: 760px) {
  [data-page=home] #plans .grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 20px; scrollbar-width: none; }
  [data-page=home] #plans .grid::-webkit-scrollbar { display: none; }
  [data-page=home] #plans .tile.plan { flex: 0 0 82%; scroll-snap-align: center; }
}
[data-page=home] #plans .price { font-size: 34px; white-space: nowrap; }
[data-page=home] #plans .price small { font-size: 13px; font-family: var(--font); }
@supports not (backdrop-filter: blur(1px)) { .nav, .card, .tile, .showcase { background-color: rgba(var(--bg2), .92); } }
@media (prefers-reduced-motion: reduce) { [data-page=home]::before { animation: none; } [data-page=home] .rv { opacity: 1; transform: none; } }
@media (max-width: 520px) { .nav { gap: 4px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; } .nav::-webkit-scrollbar { display: none; } .nav a.l { padding: 12px 5px; white-space: nowrap; } .nav .btn { flex: none; } }

/* nav: left sidebar on desktop, slide-in drawer on phones. Same links, now vertical */
.nav { position: static; height: auto; display: block; padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }
.nav .nav-top { position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background-color: rgba(var(--bg0), .6); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border-bottom: 1px solid var(--hair); }
.nav .nav-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .06); color: var(--porcelain); cursor: pointer; }
.nav .nav-btn .ic { width: 20px; height: 20px; }
.nav .nav-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.nav .nav-panel { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(300px, 84vw); display: flex; flex-direction: column; gap: 4px; padding: 12px; background-color: rgba(var(--bg1), .82); background-image: linear-gradient(135deg, rgba(var(--ov), .1), rgba(var(--ov), .02)); -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); border-right: 1px solid rgba(var(--ov), .14); box-shadow: inset -1px 0 0 rgba(var(--ov), .06), 12px 0 40px rgba(0, 0, 0, .4); transform: translateX(-102%); transition: transform .4s cubic-bezier(.16, 1, .3, 1); overflow-y: auto; }
.nav.open .nav-panel { transform: none; }
.nav.open .nav-scrim { opacity: 1; pointer-events: auto; }
.nav .nav-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; }
.nav .sp { flex: 1; }
.nav .nav-panel a.l { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 9999px; font-size: 15px; color: var(--ash); transition: background-color .35s ease, color .35s ease; }
.nav .nav-panel a.l .ic { width: 20px; height: 20px; flex: none; }
.nav .nav-panel a.l:hover { background: rgba(var(--ov), .08); color: var(--porcelain); }
.nav .nav-panel a.l.on { background: rgba(var(--ov), .14); color: var(--porcelain); box-shadow: inset 0 1px 0 rgba(var(--ov), .25); }
.nav .nav-panel .btn { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .nav .nav-panel, .nav .nav-scrim { transition: none; } }

/* plan tiles: solid warm fill instead of per-tile backdrop blur (many blurred layers re-painted on a currency switch caused pixel glitches on phones) */
.tile.plan { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: rgba(var(--bg2), .92); }
.view.still { animation: none; }

/* ---------- model picker: vendor logos, big tap rows, vendor filter ---------- */
.vchips { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.vchips::-webkit-scrollbar { display: none; }
.vchips button { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .05); color: var(--ash); font: 500 13px var(--font); cursor: pointer; transition: background-color .35s ease, color .35s ease; }
.vchips button.on { background: var(--porcelain); color: var(--on-porcelain); border-color: var(--porcelain); }
.vlogo { flex: none; width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; background: rgba(var(--ov), .08); border: 1px solid var(--hair); color: var(--porcelain); }
.vlogo svg { width: 19px; height: 19px; fill: currentColor; }
.vlogo .ic { width: 18px; height: 18px; }
.vlogo img { width: 21px; height: 21px; object-fit: contain; }
.vlogo b { font: 700 15px 'Inter', var(--font); }
.vlogo.xs { width: 20px; height: 20px; border-radius: 8px; border: 0; background: none; }
.vlogo.xs svg { width: 15px; height: 15px; } .vlogo.xs img { width: 16px; height: 16px; } .vlogo.xs b { font-size: 12px; }
.vchips button.on .vlogo { color: var(--on-porcelain); }
.vopt { font-family: var(--font); width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; margin-bottom: 6px; border-radius: 14px; border: 1px solid var(--hair); background: rgba(var(--ov), .04); color: var(--porcelain); text-align: left; cursor: pointer; transition: background-color .35s ease, border-color .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1); }
.vopt:hover { background: rgba(var(--ov), .08); } .vopt:active { transform: scale(.985); }
.vopt[hidden] { display: none; }
.vopt.on { border-color: rgba(var(--ov), .6); background: rgba(var(--ov), .1); }
.vtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.vtxt b { font: 600 15px/1.3 'Inter', 'Prompt', var(--font); letter-spacing: -.015em; font-feature-settings: 'ss01', 'cv11'; } /* ชื่อโมเดล: Inter (โหลดไว้แล้ว) คมกว่า Roboto ของ Android */
.vtxt small { color: var(--ash); font: 400 12px/1.4 var(--font); }
.vmult { flex: none; padding: 2px 8px; border-radius: 9999px; background: rgba(var(--ov), .08); border: 1px solid var(--hair); font: 600 12px var(--font); font-variant-numeric: tabular-nums; }
.vck { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--porcelain); color: var(--on-porcelain); }
.vck .ic { width: 12px; height: 12px; }

/* limit sheet: grant-able reset button */
.rst { margin-top: 14px; padding: 14px; border-radius: 20px; border: 1px solid rgba(var(--ov), .18); background: rgba(var(--ov), .06); }
.rst-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gdot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.cb.pick { gap: 6px; } .cb.pick .vlogo.xs { width: 22px; height: 22px; }
/* composer row: keep the send button on the same line; the model pill shrinks (ellipsis) instead of wrapping */
.crow:has(> .send) { flex-wrap: nowrap; }
.crow:has(> .send) > .cb:not(.pick), .crow:has(> .send) > .send { flex: none; }
.crow:has(> .send) > .cb.pick { flex: 0 1 auto; min-width: 0; }

/* "+" tool sheet: 2-column tiles instead of a tall list */
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tgrid .opt { display: flex; position: relative; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; min-height: 92px; padding: 12px; margin: 0; border-radius: 16px; text-align: left; }
.tgrid .opt-t { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 15px; font-weight: 600; }
.tgrid .opt-t .ic { width: 22px; height: 22px; }
.tgrid .opt-d { font-size: 12px; line-height: 1.35; color: var(--ash); }
.tgrid .opt > i { position: absolute; top: 10px; right: 10px; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--porcelain); color: var(--on-porcelain); }
.tgrid .opt > i .ic { width: 12px; height: 12px; }

.rst-b { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.rst-b .pill { background: rgba(0, 0, 0, .25); color: #fff; }

/* ---------- leftovers from the chat/code critique ---------- */
/* flat controls inside the app shells: blur on every small chip cost scanability and phone GPU */
.chat .btn.out, .chat .btn.dark, .chat .lim, .chat .chips button, .ide .btn.out, .ide .btn.dark, .ide .lim, .ide .tabs button, .compose .cbox .cb,
.chat input, .chat select, .chat textarea, .ide input, .ide select, .ide textarea, .compose .cbox textarea { -webkit-backdrop-filter: none; backdrop-filter: none; background-image: none; box-shadow: none; }
.chat .btn.out, .chat .btn.dark, .chat .lim, .chat .chips button, .ide .btn.out, .ide .btn.dark, .ide .lim, .ide .tabs button { background-color: rgba(var(--ov), .05); border-color: rgba(var(--ov), .1); }
/* /code project list: work first, small header */
.code-hero h1 { font-size: 30px; margin: 0 0 4px; } .code-hero p { font-size: 14px; margin: 0 auto 4px; }
.code-hero::before { display: none; }
/* finger-sized targets on touch screens */
@media (pointer: coarse) {
  .chat .cb, .chat .lim, .chat .icon-btn, .chat .acts button, #newf, #sbtn, .side .item button, .ide .lim, .ide-tools button, .ftools .btn.sm, .ide select, .ide .ai-h button, .run-h button, .ide #git { min-height: 44px; min-width: 44px; }
  .chat .logo, .ide .logo { display: inline-flex; align-items: center; min-height: 44px; }
  .chat .menu-btn, .chat .send, .chat .empty button, .side [data-fren], .side [data-fdel] { min-height: 44px; min-width: 44px; }
}

.rst-b > span:first-child { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.rst-e { font: 400 11px var(--font); opacity: .8; }
.rst-h2 { margin-top: 12px; } .rst-h2 summary { cursor: pointer; color: var(--ash); font-size: 13px; min-height: 36px; display: flex; align-items: center; }
.rst-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--hair); font-size: 13px; } .rst-row small { color: var(--ash); flex: none; }

/* pricing: official vs ours */
.pc-v { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pc-v .oc { font: 400 12px var(--font); color: var(--ash); white-space: nowrap; }
.pc-v .oc .ok { color: var(--green); } .pc-v .oc .bad { color: var(--red); }
/* seg buttons sitting side by side (pricing hero): the currency one had a 16px bottom margin and floated higher */
.hero .row { align-items: center; row-gap: 10px; } .hero .row > .seg { margin-bottom: 0; }
/* ชื่อแบรนด์ ASTRACODE ตัวพิมพ์ใหญ่ทุกหน้า */
.logo, .hero .name, .foot b { text-transform: uppercase; }

/* ---------- top-right of the page nav: limit ring, wallet, account / log in + sign up ---------- */
.nav .nav-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav .nav-r .btn { white-space: nowrap; }
.nav-lim, .nav-wal { height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .06); color: var(--porcelain); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.nav-lim:hover, .nav-wal:hover { background: rgba(var(--ov), .12); }
.nav-av { width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(75, 79, 224, .22); border: 1px solid rgba(75, 79, 224, .55); color: var(--porcelain); font: 600 14px var(--font); }
@media (max-width: 440px) { .nav .nav-login { display: none; } .nav-wal { display: none; } }
@media (pointer: coarse) { .nav-lim, .nav-wal { min-height: 44px; } .nav-av { width: 44px; height: 44px; } }

/* ---------- account page ---------- */
.acc-head { display: flex; align-items: center; gap: 16px; padding: 32px 0 8px; }
.acc-av { width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 50%; font: 600 26px var(--display); color: var(--porcelain); background: radial-gradient(circle at 30% 25%, rgba(75, 79, 224, .55), rgba(75, 79, 224, .14)); border: 1px solid rgba(75, 79, 224, .55); box-shadow: inset 0 1px 0 rgba(var(--ov), .3); }
.acc-id h1 { margin: 0; font: 600 30px/1.1 var(--display); }
.acc-id p { margin: 4px 0 0; color: var(--ash); font-size: 14px; word-break: break-all; }
.acc-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.acc-nav { position: sticky; top: 56px; z-index: 10; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 10px 16px; background-color: rgba(var(--bg0), .72); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.acc-nav::-webkit-scrollbar { display: none; }
.acc-nav a { flex: none; min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--hair); color: var(--ash); font: 500 13px var(--font); transition: background-color .25s, color .25s; }
.acc-nav a:hover { color: var(--porcelain); background: rgba(var(--ov), .08); }
.acc-ov { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; }
.acc-big { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 24px; border: 1px solid var(--hair); background-color: rgba(var(--bg2), .6); background-image: linear-gradient(135deg, rgba(var(--ov), .09), rgba(var(--ov), .02)); box-shadow: inset 0 1px 0 rgba(var(--ov), .14); }
.acc-big > span.muted:first-child { font-size: 13px; }
.acc-big b { font: 600 30px/1.1 var(--display); letter-spacing: -.3px; overflow-wrap: anywhere; }
.acc-big .btn { align-self: flex-start; margin-top: 6px; }
.acc-c { padding: 22px 20px; border-radius: 24px; scroll-margin-top: 120px; }
.acc-t { font: 600 18px var(--display); margin: 0 0 14px; }
.acc-c label:not(.tg) { display: block; margin-top: 12px; font-size: 13px; color: var(--ash); }
.acc-c .row { align-items: stretch; }
.acc-c .row input { min-width: 0; }
.acc-meter { padding: 12px 0; }
.acc-meter + .acc-meter { border-top: 1px solid var(--hair); }
.am-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 15px; }
.am-h b { font: 600 24px var(--display); }
.bar1.lg { height: 10px; border-radius: 9999px; }
.bar1.lg div { border-radius: 9999px; }
.acc-meter.hi .bar1 div { background: var(--yellow); } .acc-meter.full .bar1 div { background: var(--red); }
.acc-meter small { display: block; margin-top: 8px; font-size: 12.5px; }
.acc .mem { background: rgba(var(--ov), .04); border: 1px solid var(--hair); }
.acc .ubar i { background: linear-gradient(var(--link), var(--blue)); }
@media (max-width: 420px) { .acc-big { padding: 16px; } .acc-big b { font-size: 26px; } }
.mem.tm { flex-wrap: wrap; row-gap: 8px; }
.mem .mu { flex-basis: 100%; display: flex; align-items: center; gap: 10px; padding: 0 8px 4px 0; font-size: 12px; }
.mem .mu .bar1 { flex: 1; } .mem .mu select { min-height: 32px; width: auto; padding: 0 8px; font-size: 12px; border-radius: 9999px; }

/* ---------- code page: file drawer (phones) behind a hamburger at the top left ---------- */
.ide-files .ftools { order: -1; }
.dr-tabs, .dr-head, .ide-scrim, .ide-burger { display: none; }
@media (max-width: 999px) {
  .ide-bar .ide-back { display: none; }
  .ide-burger { display: inline-grid; }
  .ide .ide-files { display: flex; position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(320px, 86vw); border: 0; border-right: 1px solid var(--hair); transform: translateX(-102%); transition: transform .3s ease; background-color: rgba(var(--bg1), .94); -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%); padding-top: env(safe-area-inset-top); }
  .ide[data-drawer="1"] .ide-files { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .6); }
  .ide-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
  .ide[data-drawer="1"] .ide-scrim { opacity: 1; pointer-events: auto; }
  .dr-tabs { display: flex; justify-content: space-around; padding: 8px 6px; border-bottom: 1px solid var(--hair); }
  .dr-tabs button, .dr-tabs a { width: 48px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 12px; background: none; color: var(--ash); cursor: pointer; }
  .dr-tabs .ic { width: 22px; height: 22px; }
  .dr-tabs button.on { color: var(--porcelain); background: rgba(var(--ov), .12); box-shadow: inset 0 -2px 0 var(--blue); }
  .dr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 8px 16px; }
  .dr-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .dr-head b { font: 600 17px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dr-back { font-size: 12.5px; color: var(--ash); }
  .ide-files .ftools { order: 0; border-bottom: 0; border-top: 1px solid var(--hair); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .ide-files .ftools .btn { flex: none; }
  .ide .ide-files .tree { padding: 6px 10px 12px; }
  .ide-files .tname { min-height: 44px; }
  .ide-nav button[data-pane-btn="files"] { display: flex; }
}

.dr-find { padding: 8px 10px 4px; flex: none; }
.dr-find input { width: 100%; min-height: 38px; font-size: 14px; border-radius: 9999px; padding: 0 14px; }
.recent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 12px 2px; flex: none; }
.recent:empty { display: none; }
.recent .muted { font-size: 12px; margin-right: 2px; }
.recent button { min-height: 28px; padding: 0 10px; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .05); color: var(--porcelain); font: 400 12px var(--font); cursor: pointer; }
.recent button.on { border-color: var(--blue); color: var(--link); }
.cmdbar, #aiclose { display: none; }
@media (max-width: 999px) {
  /* AI modes: sheet / bar float over the code, split docks it below */
  .ide[data-aimode="sheet"] .ide-ai, .ide[data-aimode="bar"] .ide-ai { display: flex; position: fixed; left: 0; right: 0; bottom: calc(54px + env(safe-area-inset-bottom)); height: 54vh; z-index: 50; border: 0; border-top: 1px solid var(--hair); border-radius: 22px 22px 0 0; transform: translateY(115%); transition: transform .3s ease; background-color: rgba(var(--bg1), .96); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); }
  .ide[data-ai="1"][data-aimode="sheet"] .ide-ai, .ide[data-ai="1"][data-aimode="bar"] .ide-ai { transform: none; }
  .ide[data-aimode="sheet"] #aiclose, .ide[data-aimode="bar"] #aiclose { display: inline-grid; }
  .ide[data-aimode="bar"][data-pane="code"] .cmdbar { display: flex; flex-direction: column; gap: 6px; }
  .ide[data-aimode="split"] .ide-body { grid-template-rows: minmax(0, 1fr) minmax(0, 46%); }
  .ide[data-aimode="split"][data-pane="code"] .ide-ai { display: flex; border: 0; border-top: 1px solid var(--hair); }
  .cmdbar { flex: none; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--hair); background: var(--graphite); }
  .cmdbar input { flex: 1; min-width: 0; min-height: 40px; border-radius: 9999px; padding: 0 14px; font-size: 14px; }
  .cmd-in button { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: rgba(var(--ov), .24); color: #fff; display: inline-grid; place-items: center; cursor: pointer; }
  .cmd-in button .ic { width: 18px; height: 18px; }
}
/* code page: tighter file list / menu text */
.ide .tname { font-size: 13px; } .ide .tmenu button { font-size: 13px; padding: 9px 14px; }
.ide .tname, .ide .tmore { min-height: 36px; }
@media (max-width: 999px) { .ide .ide-files .tname { min-height: 38px; } .ide .tmore { width: 38px; height: 38px; } .dr-head b { font-size: 16px; } .ftools .btn.sm { font-size: 12px; } }
.cmd-in { display: flex; gap: 8px; align-items: center; }
.cmd-opts { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.cmd-opts button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .05); color: var(--porcelain); font: 500 12px var(--font); cursor: pointer; }
.cmd-opts button[hidden] { display: none; }
.cmd-opts .muted { flex: none; font-size: 11.5px; white-space: nowrap; }
.sel-bg { z-index: 80; }
.sel-sheet .opt { margin-bottom: 4px; }
.sel-sheet .opt i { display: inline-flex; align-items: center; color: var(--link); }
.sel-sheet .opt[disabled] { opacity: .4; }

/* code editor: soft warm glow behind the text, glass gutter */
.ide-editor { background: radial-gradient(760px 380px at 92% -8%, rgba(75, 79, 224, .13), transparent 62%), radial-gradient(640px 360px at -8% 108%, rgba(107, 111, 245, .08), transparent 62%), linear-gradient(180deg, #100d0b, #0b0908); }
.ide-editor .cm-scroller { scrollbar-width: thin; scrollbar-color: rgba(var(--ov), .14) transparent; }
.ide-editor .cm-foldGutter span { color: #6b7385; }
/* project image viewer */
.ide-main.isimg .ide-editor { display: none; }
.imgview { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 16px; background: radial-gradient(760px 380px at 92% -8%, rgba(75, 79, 224, .13), transparent 62%), #0b0908; }
.iv-box { max-width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.iv-box img { max-width: 100%; max-height: 55vh; border-radius: 16px; border: 1px solid var(--hair); background: repeating-conic-gradient(#1b1714 0 25%, #0e1116 0 50%) 0 0 / 16px 16px; box-shadow: 0 12px 36px rgba(0, 0, 0, .5); }
.iv-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.iv-meta b { word-break: break-all; }
.ide-main.isimg .mkeys, .ide-main.isimg .ide-tools, .ide-main.isimg .cmdbar { display: none; }
.imgview { place-items: start center; }

/* waiting text: cycles through phrases with a soft shimmer instead of bouncing dots */
.waitx { display: inline-grid; padding: 8px 0; font-size: 14.5px; }
.waitx span { grid-area: 1 / 1; opacity: 0; white-space: nowrap; background: linear-gradient(90deg, var(--ash) 0, var(--ash) 35%, #fff 50%, var(--ash) 65%, var(--ash) 100%) 0 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; animation: waitFade 9s infinite, shimmer 1.8s linear infinite; }
.waitx span:nth-child(2) { animation-delay: 3s, 0s; } .waitx span:nth-child(3) { animation-delay: 6s, 0s; }
@keyframes waitFade { 0% { opacity: 0; transform: translateY(5px); } 5%, 30% { opacity: 1; transform: none; } 35%, 100% { opacity: 0; transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .waitx span { animation: none; } .waitx span:first-child { opacity: 1; background: none; -webkit-text-fill-color: var(--ash); color: var(--ash); } }
/* current chat in the sidebar */
.side .item.on { background: rgba(var(--ov), .11); box-shadow: inset 0 1px 0 rgba(var(--ov), .14), inset 3px 0 0 var(--blue); }
.side .item.on a { color: var(--porcelain); font-weight: 500; }
.side .item:not(.on):hover { background: rgba(var(--ov), .06); }

/* composer: flags (web search, skills, auto-apply...) on their own line; chips never clip their arrows */
.cflags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 6px; }
.cflags:empty { display: none; }
.crow:has(> .send) > #eff, .crow:has(> .send) > #ceff, .crow:has(> .send) > #beff { flex: none; }
.crow:has(> .send) > #mdl, .crow:has(> .send) > #cmdl { flex: 0 1 auto; min-width: 0; }
#mic .ic { width: 22px; height: 22px; }
.cb.pick { overflow: hidden; }
.cb .ic { flex: none; }
.cb { justify-content: center; } /* ปุ่มไอคอนล้วน (ไมค์ ฯลฯ) อยู่กึ่งกลางกรอบ ไม่เบี้ยวซ้าย */
.dr-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dr-back, .dr-exit { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 9999px; border: 1px solid var(--hair); font-size: 12.5px; color: var(--porcelain); background: rgba(var(--ov), .06); }
.dr-exit { background: rgba(75, 79, 224, .18); border-color: rgba(75, 79, 224, .5); }
.waitx { position: relative; }
.waitslow { display: block; margin-top: 4px; font-size: 12px; color: var(--slate); opacity: 0; animation: waitslow .5s ease 25s forwards; white-space: normal; max-width: 280px; }
@keyframes waitslow { to { opacity: 1; } }
.acts button[data-vote].on { color: var(--porcelain); background: rgba(var(--ov), .14); border-radius: 9999px; }
.rep { padding: 12px 0; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.rep.done { opacity: .55; }

/* skeleton while a page loads */
.skel { padding-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.sk { border-radius: 14px; background: linear-gradient(90deg, rgba(var(--ov), .04) 25%, rgba(var(--ov), .1) 50%, rgba(var(--ov), .04) 75%) 0 0 / 200% 100%; animation: shimmer 1.6s linear infinite; }
.sk.h { height: 36px; width: 55%; } .sk.p { height: 16px; width: 80%; } .sk.p.s { width: 50%; } .sk.b { height: 96px; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.pill.sale { background: rgba(255, 99, 88, .2); color: #ff9a92; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--porcelain); color: var(--on-porcelain); padding: 10px 16px; border-radius: 9999px; }
.skip:focus { left: 12px; }

/* ---------- light theme (data-theme set by /theme.js: light, dark or follows the system) ---------- */
:root[data-theme="light"] {
  --obsidian: #f6f7fb; --graphite: #eef0f6; --carbon: #ffffff; --steel: #e3e6ee; --slate: #8a90a0;
  --ash: #5b6170; --porcelain: #0e1116; --blue: #4b4fe0; --link: #3d41c9;
  --glass: rgba(255, 255, 255, .86); --hair: rgba(14, 17, 22, .10);
  --green: #12805c; --yellow: #9a6700; --red: #d1242f;
  --ov: 14, 17, 22; --bg0: 246, 247, 251; --bg1: 255, 255, 255; --bg2: 255, 255, 255; --on-porcelain: #ffffff;
  --spectrum: linear-gradient(90deg, #14b8d9, #4b4fe0 55%, #d9409a); --accent: #4b4fe0; --accent-tint: rgba(75, 79, 224, .08);
  --ink-btn: #0e1116; --ink-btn-fg: #ffffff; --shadow-1: 0 1px 2px rgba(14, 17, 22, .04), 0 6px 24px rgba(15, 20, 40, .06);
  color-scheme: light;
}
/* code blocks and the image viewer stay dark in both themes (the Code workspace follows the theme) */
:root[data-theme="light"] .imgview {
  --obsidian: #0e1116; --graphite: #151922; --carbon: #1b202b; --steel: #2c3342; --slate: #6b7385; --ash: #a3abbd; --porcelain: #eef0f6; --blue: #6b6ff5; --link: #a9acff;
  --glass: rgba(27, 32, 43, .6); --hair: rgba(255, 255, 255, .12); --green: #30d158; --yellow: #ffd500; --red: #ff453a;
  --ov: 255, 255, 255; --bg0: 14, 17, 22; --bg1: 21, 25, 34; --bg2: 27, 32, 43; --on-porcelain: #1d1d1f; color-scheme: dark;
}
:root[data-theme="light"] pre, :root[data-theme="light"] .code { background: #0e1116; color: #eef0f6; }
:root[data-theme="light"] .btn.blue { background: var(--blue); color: #fff; border-color: transparent; box-shadow: none; }
:root[data-theme="light"] .btn.blue:hover { background: #3d41c9; }
:root[data-theme="light"] .waitx span { background: linear-gradient(90deg, var(--ash) 0, var(--ash) 35%, #000 50%, var(--ash) 65%, var(--ash) 100%) 0 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; }
:root[data-theme="light"] .side { background: var(--graphite); }
/* chat text size (S / M / L from the account page) */
.msg .b { font-size: var(--msgfs, 15px); }
.langseg { margin: 8px 12px; align-self: flex-start; }

/* lite mode (weak devices, or Glass effect = Off): no backdrop blur anywhere, solid surfaces instead */
:root[data-lite] *, :root[data-lite] *::before, :root[data-lite] *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
:root[data-lite] .nav .nav-top, :root[data-lite] .card, :root[data-lite] .tile, :root[data-lite] .showcase, :root[data-lite] .sheet, :root[data-lite] .toast, :root[data-lite] .acc-nav { background-color: rgba(var(--bg2), .97); }

/* notification bell */
.nav-bell { position: relative; width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--hair); background: rgba(var(--ov), .06); color: var(--porcelain); cursor: pointer; }
.nav-bell:hover { background: rgba(var(--ov), .12); }
.nav-bell i { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--clay, #6b6ff5); }
.notif { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin-bottom: 8px; border-radius: 14px; border: 1px solid var(--hair); border-left: 3px solid rgba(var(--ov), .3); color: inherit; text-decoration: none; }
.notif.ok { border-left-color: #34c759; } .notif.warn { border-left-color: #ff9f0a; } .notif.bad { border-left-color: #ff453a; }
.notif.new { background: rgba(var(--ov), .06); }

/* "+" sheet: quick actions row, then icon rows with a short description */
.tquick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 6px 4px 14px; }
.tq { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 92px; border: 0; border-radius: 22px; background: rgba(var(--ov), .07); color: var(--porcelain); font: 500 14px var(--font); cursor: pointer; }
.tq .ic { width: 24px; height: 24px; }
.tq:active, .trow:active { background: rgba(var(--ov), .14); }
.tnote { margin: 0 4px 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 159, 10, .12); color: var(--ash); font-size: 12.5px; }
.tlist { display: flex; flex-direction: column; }
.trow { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 8px; border: 0; border-radius: 16px; background: transparent; color: var(--porcelain); text-align: left; font: inherit; cursor: pointer; }
.trow:hover { background: rgba(var(--ov), .06); }
.tico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--hair); background: rgba(var(--ov), .05); }
.tico .ic { width: 22px; height: 22px; }
.tbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tbody b { font-size: 16px; font-weight: 600; }
.tbody small { color: var(--ash); font-size: 13px; line-height: 1.35; }
.trow.on .tico { background: var(--porcelain); color: var(--on-porcelain); }
.tchk { margin-left: auto; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--porcelain); color: var(--on-porcelain); font-style: normal; }
.tchk .ic { width: 14px; height: 14px; }

/* home: live status badge under the hero buttons */
.statusb { display: inline-flex; align-items: center; gap: 6px; margin: 14px auto 0; padding: 6px 14px; border-radius: 9999px; border: 1px solid var(--hair); background: rgba(var(--ov), .05); font-size: 13px; color: var(--ash); text-decoration: none; }
.statusb[hidden] { display: none; }
.statusb.ok { color: #34c759; } .statusb.warn { color: #ff9f0a; }
[data-page=home] .hero { text-align: center; } [data-page=home] .hero .statusb { display: inline-flex; }
[data-page=home] .hero .statusb[hidden] { display: none; }
#vs .tbl td { white-space: normal; vertical-align: top; } #vs .vsp small { white-space: nowrap; } #vs .pill { margin-top: 6px; display: inline-block; }

/* payment details block */
.pay-info { max-width: 420px; margin: 14px auto 0; padding: 12px 14px; text-align: left; border: 1px solid var(--hair); border-radius: 16px; background: rgba(var(--ov), .04); }
.pay-info .pi-r { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.pay-info .pi-r .muted { min-width: 78px; font-size: 13px; }
.pay-info .pi-r b { flex: 1; font-weight: 600; word-break: break-all; }
.pay-info summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.pay-info .thai-qr { display: block; width: min(300px, 100%); margin: 8px auto 0; border-radius: 12px; }

/* เมนูข้าง: การ์ดโปรไฟล์ */
.nav .nav-panel a.prof { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 18px; color: var(--ash); min-width: 0; }
.nav .nav-panel a.prof:hover, .nav .nav-panel a.prof.on { background: rgba(var(--ov), .1); color: var(--porcelain); }
.nav .nav-panel a.prof .pi { display: flex; flex-direction: column; min-width: 0; }
.nav .nav-panel a.prof b { font-size: 14px; font-weight: 600; color: var(--porcelain); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .nav-panel a.prof small { font-size: 12px; color: var(--ash); }
/* ช่องเลือก Skill ด้วย / */
.compose { position: relative; }
.slash { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 30; max-height: 280px; overflow-y: auto; padding: 6px; border-radius: 18px; background-color: rgba(var(--bg1), .98); border: 1px solid var(--hair); box-shadow: 0 12px 40px rgba(0, 0, 0, .45); }
.slash button { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; background: none; border: 0; color: var(--porcelain); font: inherit; cursor: pointer; }
.slash button small { grid-column: 1 / -1; color: var(--ash); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash button i { font-style: normal; color: #3ddc84; }
.slash button.on, .slash button:hover { background: rgba(var(--ov), .12); }
.slash p { margin: 8px 10px; }

.doing { color: var(--ash); font-size: 13px; padding: 2px 0 8px; }
.ctxm.warn { color: #f5b74e; } .ctxm.bad { color: #ff6b6b; }
.acts .memhint { color: #f5b74e; border-color: rgba(245,183,78,.5); }
.flag.agent-on { color: #7dcfff; border-color: rgba(125,207,255,.55); background: rgba(125,207,255,.10); font-weight: 600; }

/* รูปที่ AI สร้าง + ปุ่มดาวน์โหลดมุมขวาบน */
.genfig { position: relative; display: block; margin: 4px 0; max-width: min(100%, 512px); min-width: 64px; }
.genfig img.gen { margin: 0; }
.img-dl { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(10,10,12,.62); color: #fff; backdrop-filter: blur(8px); cursor: pointer; }
.img-dl .ic { width: 20px; height: 20px; }
.img-dl:hover { background: rgba(10,10,12,.85); }
.acts button .ic { width: 16px; height: 16px; vertical-align: -3px; }

/* context แบบละเอียด */
.ctxbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.05); gap: 1px; }
.ctxbar i { display: block; min-width: 2px; }
.ctxbar.meter { height: 10px; gap: 0; } .ctxbar.meter i { min-width: 3px; }
.ctxs .cx-head { font-size: 15px; } .ctxs .cx-head b { font: 600 26px var(--display, inherit); }
.ctxs .cx-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ash); margin-top: -4px; }
.ctxs .cx-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: rgba(var(--ov, 255,255,255), .06); border: 1px solid var(--hair); vertical-align: -1px; }
.ctxs .cx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.ctxs .cx-k { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; min-width: 0; }
.ctxs .cx-k b { font: 600 18px var(--font); } .ctxs .cx-k small { font-size: 11.5px; }
.ctxs .cx-t td, .ctxs .cx-t th { white-space: nowrap; }
.ctxs .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.ctxs td:nth-child(2), .ctxs td:nth-child(3) { text-align: right; white-space: nowrap; }
button.ctxm { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

/* แถวปุ่มใต้คำตอบ: ขึ้นบรรทัดใหม่ได้ ไม่บีบชื่อโมเดลและไม่ตัดปุ่ม */
.acts { flex-wrap: wrap; row-gap: 2px; }
.acts button { white-space: nowrap; flex: none; }
.msg.ai .acts .muted { flex: 1 0 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 0 2px; }
@media (min-width: 640px) { .msg.ai .acts .muted { flex: 0 1 auto; margin: 0 6px 0 0; } }
.acts .tok { margin-left: auto; }
/* แถวฟอร์มที่ป้ายยาวไม่เท่ากัน: ให้ช่องกรอกชิดล่างเสมอ ไม่เหลื่อมกัน */
.form2 { align-items: end; }
.form2 > div { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
/* ฟอร์มสร้าง key / webhook บนจอเล็ก: ช่องกรอกเต็มแถว ปุ่มอยู่ล่าง */
@media (max-width: 520px) { .row.stack-m { flex-wrap: wrap !important; } .row.stack-m > input:first-child { flex: 1 1 100%; } .row.stack-m > select { flex: 1 1 auto; } }

/* แถบแท็บที่เลื่อนข้างได้: เงาจางขวาบอกว่ายังมีรายการต่อ (เว้นท้ายแถบไว้ให้เลื่อนพ้นเงา) */
.acc-nav { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); padding-right: 44px; }
@media (max-width: 820px) { .adm-nav { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); padding-right: 44px; } }
/* ตารางบนจอเล็ก: ให้ข้อความขึ้นบรรทัดใหม่ได้ จะได้พอดีจอมากขึ้น ไม่ต้องเลื่อนข้างทุกตาราง */
@media (max-width: 520px) { .tw th, .tw td { white-space: normal; padding: 8px 6px; } .tw table, .tbl { font-size: 12.5px; } }
.ide-tools button .ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }

/* จอแคบมาก (≤360px): แถบบนไม่ดันหน้าเว็บให้เลื่อนข้าง */
@media (max-width: 360px) {
  .nav .nav-top { gap: 6px; padding: 0 8px; }
  .nav .logo { font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .nav .nav-r { gap: 5px; flex: none; }
  .nav-lim { padding: 0 8px; gap: 5px; }
  .nav-wal { display: none; }
}
/* แถบปุ่มของหน้าผลลัพธ์ (Output/Console/Terminal/Fullscreen/Stop): เลื่อนข้างได้ + เงาจางขวา */
.run-h { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 36px; }
.run-h::-webkit-scrollbar { display: none; }

/* ข้อความ error + ปุ่มลองใหม่ใต้ช่องพิมพ์: ปุ่มไม่ทับข้อความ (จอแคบข้อความขึ้นหลายบรรทัด) */
.compose .err .btn { display: flex; width: fit-content; margin: 8px auto 0; position: static; }
/* จอแคบ: ปุ่มเลือกโมเดลไม่ถูกบีบจนเหลือแต่ไอคอน (โหมดเทียบ 2 โมเดลมี 2 ปุ่ม ให้ขึ้นบรรทัดใหม่แทน) */
@media (max-width: 380px) { .cb.pick { min-width: 96px; max-width: none; flex: 1 1 96px; } .crow { flex-wrap: wrap; } }

/* จอเตี้ย (มือถือแนวนอน): โหมดแบ่งจอให้ AI แค่ 46% ช่องพิมพ์สูงเกินจนทับแถบแท็บล่าง → ให้ AI 72% */
@media (max-width: 999px) and (max-height: 480px) {
  .ide[data-aimode="split"] .ide-body { grid-template-rows: minmax(0, 1fr) minmax(0, 72%); }
  .ide[data-aimode="split"] .ide-ai { overflow-y: auto; }
  .ide-ai .ai-h { min-height: 0; padding-top: 2px; padding-bottom: 2px; } .ide-ai .ai-h .icon-btn, .ide-ai .ai-h .lim { width: 32px; height: 32px; min-height: 0; }
}

/* หน้าแรก: แอนิเมชันจำลองทีม Agent / Deep research (วนทุก 9 วินาที · ลดการเคลื่อนไหว = แสดงสถานะเสร็จ) */
.demos { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.demo { display: flex; flex-direction: column; gap: 8px; text-align: left; --t: 9s; }
.dm-h { display: flex; align-items: center; gap: 6px; font: 600 15px var(--display); }
.dm-q { padding: 8px 12px; border-radius: 14px; background: rgba(var(--ov), .06); font-size: 13.5px; }
.dm-row { display: grid; grid-template-columns: 58px 1fr auto auto; align-items: center; gap: 8px; font-size: 13px; opacity: 0; animation: dmIn var(--t) infinite; }
.dm-row b { font-weight: 600; color: var(--ash); font-size: 12px; } .dm-row small { color: var(--ash); }
.dm-row.lead { animation-delay: 0s; } .dm-row.w { animation-delay: calc(var(--i) * .25s + .6s); } .dm-row.rv, .dm-rep { animation: dmIn var(--t) infinite; animation-delay: 5.2s; opacity: 0; }
.dm-bar { display: block; width: 56px; height: 5px; border-radius: 9px; background: rgba(var(--ov), .1); overflow: hidden; }
.dm-bar i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--blue); border-radius: 9px; animation: dmFill var(--t) infinite; animation-delay: calc(var(--i) * .25s + .6s); }
.dm-row em { font-style: normal; color: var(--green); opacity: 0; animation: dmDone var(--t) infinite; animation-delay: calc(var(--i) * .25s + .6s); }
.dm-rep { display: grid; gap: 6px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--hair); }
.dm-rep i { display: block; height: 6px; border-radius: 9px; background: rgba(var(--ov), .12); } .dm-rep i:nth-child(2) { width: 85%; } .dm-rep i:nth-child(3) { width: 60%; }
.dm-rep small { color: var(--ash); font-size: 12px; }
@keyframes dmIn { 0% { opacity: 0; transform: translateY(4px); } 4%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes dmFill { 0%, 8% { transform: scaleX(0); } 40%, 100% { transform: scaleX(1); } } /* transform ไม่ทำให้คำนวณเลย์เอาต์ใหม่ทุกเฟรม */
@keyframes dmDone { 0%, 38% { opacity: 0; } 42%, 92% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dm-row, .dm-rep, .dm-row em { animation: none; opacity: 1; } .dm-bar i { animation: none; transform: none; } }

.ic.ok { color: var(--green); }
.pc-msg { margin: 10px 0 0; font-size: 14px; } .pc-msg small { display: block; font-size: 12px; }
.tok-help { max-width: 720px; margin: 0 auto 18px; text-align: left; } .tok-help summary { cursor: pointer; } .tok-help p { margin: 10px 0 0; line-height: 1.6; font-size: 14px; }
.pill.new { background: var(--blue); color: #fff; font-size: 10.5px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
.cmp th[scope=row], .tbl th[scope=row] { font-weight: inherit; text-align: left; color: inherit; }
/* light theme: ผ่าน contrast 4.5:1 (axe) · ปุ่มส้มเข้มขึ้นเล็กน้อย, เขียวเข้มขึ้น, หัวกล่องโค้ด (พื้นเข้มทั้งสองธีม) ใช้สีอ่อน */
:root[data-theme="light"] .btn.blue { background: #3d41c9; }
:root[data-theme="light"] .btn.blue:hover { background: #8f3d24; }
:root[data-theme="light"] { --green: #177233; }
:root[data-theme="light"] .code-h, :root[data-theme="light"] .code-h span, :root[data-theme="light"] .cp-code { color: #b8afa3; }
.tsub { margin: 10px 4px 2px; font-size: 12px; color: var(--ash); }
.flag.on { border-color: var(--blue); color: var(--link); }
/* ช่องพิมพ์ไม่ชิดขอบล่าง/คีย์บอร์ดบนมือถือ */
@media (max-width: 760px) { .compose { padding-bottom: calc(12px + env(safe-area-inset-bottom)); } }
.promo-pill { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; padding: 4px 10px; border-radius: 12px; background: rgba(48, 209, 88, .14); color: var(--green); font: 600 12.5px var(--font); } .promo-pill small { flex-basis: 100%; font-weight: 400; opacity: .85; }
.ide-tools button { flex: none; } /* ปุ่มไม่หดจนตัวหนังสือทับกัน: เกินจอให้เลื่อนข้าง */
#cctx { white-space: nowrap; font-size: 12px; margin-left: 8px; color: var(--ash); } #cctx.warn { color: #f5b74e; } #cctx.bad { color: #ff6b6b; }
.nav-wal .w-add { display: inline-flex; align-items: center; gap: 2px; color: var(--green); font-weight: 600; } .nav-wal .w-t { display: none; } @media (min-width: 1000px) { .nav-wal .w-t { display: inline; margin-left: 4px; font-size: 12.5px; } }
/* มือถือ: ยอด Wallet ซ่อน เหลือปุ่ม + เติมเงิน ให้เห็นทางไปหน้าเติมเงินเสมอ (เดิมซ่อนทั้งปุ่ม) */
@media (max-width: 440px) { .nav .nav-wal { display: inline-flex; padding: 0 9px; } .nav-wal .w-amt { display: none; } } /* จอแคบ: ไอคอนกระเป๋า + เครื่องหมายบวก (ข้อความไม่พอที่) */
.nav-wal .w-add .ic { margin-right: 1px; }
@media (max-width: 440px) { .nav-r { gap: 5px; } .nav .logo { letter-spacing: 0; } }

/* โหมดเสียงแบบโทรคุย */

/* ห้องทำงานทีม Agent แบบการ์ตูน */
.ag-stage { position: relative; margin: 4px 0 10px; border-radius: 18px; overflow: hidden; background: linear-gradient(#f6f1e8, #ece3d4); aspect-ratio: 360 / 230; }
.ag-stage svg { display: block; width: 100%; height: 100%; }
.ag-b { position: absolute; transform: translate(-50%, -100%); max-width: 30%; padding: 2px 7px; border-radius: 9px; background: #fff; color: #222; font-size: 9.5px; line-height: 1.25; box-shadow: 0 2px 6px rgba(0,0,0,.18); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: center; pointer-events: auto; }
.ag-b::after { display: none; }
.ag-b::after { content: ''; position: absolute; left: 50%; bottom: -4px; margin-left: -4px; border: 4px solid transparent; border-bottom: 0; border-top-color: #fff; }
.ag-b.on { background: #fffbe6; font-weight: 600; }
.ag-p .arm { transform-box: fill-box; transform-origin: 100% 50%; } .ag-p .arm.r { transform-origin: 0% 50%; }
.ag-p.on .arm { animation: agtype .35s ease-in-out infinite alternate; animation-delay: var(--d); }
.ag-p.on .scr { animation: agscr 1.6s steps(2) infinite; }
.ag-p .zzz { animation: agz 2s ease-in-out infinite; }
.ag-stage .clk { transform-box: fill-box; transform-origin: 50% 100%; animation: agclk 6s linear infinite; }
@keyframes agtype { to { transform: translateY(1.6px); } }
@keyframes agscr { 50% { fill: #93c5fd; } }
@keyframes agz { 50% { transform: translateY(-4px); opacity: .5; } }
@keyframes agclk { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ag-stage * { animation: none !important; } }
.ag-doing { margin: 0 0 8px; font-size: 13px; color: var(--muted, #999); }
small.ag-doing { display: block; margin: 2px 0 0; color: #d9a400; }

.btn.pend { border-color: #d9a400; color: #d9a400; }

.nav .l.dot span::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: #ef4444; vertical-align: super; }

/* หน้าเลือกโมเดล: เล็กลง ~30% ให้เห็นหลายตัวในจอเดียว · โมเดลที่ต้องเติมเครดิตจางลง */
.vopt { min-height: 38px; padding: 5px 9px; gap: 8px; margin-bottom: 4px; border-radius: 11px; }
.vopt .vlogo { width: 26px; height: 26px; border-radius: 8px; } .vopt .vlogo svg { width: 14px; height: 14px; } .vopt .vlogo img { width: 16px; height: 16px; } .vopt .vlogo .ic { width: 14px; height: 14px; }
.vopt .vtxt b { font-size: 13.5px; } .vopt .vtxt small { font-size: 11px; line-height: 1.3; }
.vopt .vmult { padding: 1px 6px; font-size: 11px; } .vopt .vck { width: 16px; height: 16px; }
.vchips button { min-height: 30px; padding: 0 10px; font-size: 12px; }
.vopt.lock { opacity: .55; } .vopt.lock:hover { opacity: .8; }

/* Code workspace ในธีมขาว */
:root[data-theme="light"] .ide-editor { background: linear-gradient(180deg, #ffffff, #f7f2ea); }
:root[data-theme="light"] .ide-tabs, :root[data-theme="light"] .tab { border-color: var(--hair); }
:root[data-theme="light"] .tab.on { background: var(--carbon); }
:root[data-theme="light"] .ide-tools { border-bottom-color: var(--hair); }
:root[data-theme="light"] .ide-editor .cm-foldGutter span { color: #a3abbd; }

.run-h > * { flex: none; } .run-h button { display: inline-flex; align-items: center; gap: 4px; } /* ปุ่มขวาบนของแผงรันไม่บีบทับกัน */

/* ปุ่มเลือกไฟล์: แบบปุ่มของเว็บ แทนปุ่มเทาของเบราว์เซอร์ */
input[type=file] { font: 400 14px var(--font); color: var(--ash); }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 16px; border-radius: 9999px; border: 1px solid var(--steel); background: var(--carbon); color: var(--porcelain); font: 600 14px var(--font); cursor: pointer; transition: background-color .2s; }
input[type=file]::file-selector-button:hover { background: var(--graphite); }
/* แถบเมนูหลังบ้านบนมือถือ: ไม่ลอยตามจอ (เคยทับเนื้อหาตอนเลื่อน) */
@media (max-width: 820px) { .adm-nav { position: static; background: none; backdrop-filter: none; border-bottom-color: var(--hair); } }

/* แบ่งจอบนมือถือ: โค้ดบน ผลลัพธ์ล่าง */
#split { display: none; }
@media (max-width: 999px) {
  #split { display: inline-flex; align-items: center; gap: 4px; } #split.on { color: var(--porcelain); background: var(--carbon); }
  .ide[data-split][data-pane="code"] .ide-run { display: flex; flex: 0 0 45%; height: auto; border-top: 1px solid var(--hair); }
  .ide[data-split][data-pane="code"] .ide-editor { flex: 1 1 55%; }
}

.vnew { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 9999px; background: var(--blue); color: #fff; font: 600 10.5px var(--font); vertical-align: middle; }

.pyout { border-top: 1px solid var(--hair); padding: 8px 12px; } .pyout pre { margin: 0; white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, monospace; max-height: 320px; overflow: auto; background: none; } .pyout img { display: block; max-width: 100%; margin-top: 8px; border-radius: 8px; background: #fff; }

.diff-b .hunk { display: flex; align-items: center; gap: 6px; margin: 10px 0 2px; padding: 4px 8px; font: 600 12px var(--font); color: var(--porcelain); background: rgba(var(--ov), .06); border-radius: 6px; cursor: pointer; }

/* เปลี่ยนหน้าแบบจางเข้า (View Transitions ข้ามหน้า: Chrome/Android 126+, Safari 18.2+ · เบราว์เซอร์อื่นเปลี่ยนหน้าแบบเดิม) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vtOut .12s ease-in both; }
::view-transition-new(root) { animation: vtIn .2s ease-out both; }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; } }
.tbl-x { margin: 6px 0 12px; }
.selbar { display: flex; gap: 6px; justify-content: center; padding: 6px 8px; animation: fadeUp .15s ease-out both; }
.selbar button { min-height: 36px; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--hair); background: var(--carbon); color: var(--porcelain); font: 500 13px var(--font); cursor: pointer; }
/* การ์ดแพลน: กี่เท่าของ Free (เด่น) · คำอธิบายไม่เกิน 3 บรรทัด · ชื่อโมเดลเป็นชิป */
.pm-x { margin: 6px 0 4px; font-size: 14.5px; } .pm-x b { font-size: 17px; color: var(--link); white-space: nowrap; }
.pm-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; }
.pm-head { margin: 12px 0 6px; font-size: 12.5px; opacity: .65; }
.pm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-chip { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--steel); font-size: 12.5px; white-space: nowrap; }
.pm-more { padding: 3px 9px; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--link); cursor: pointer; }
.pm-api { margin-top: 12px; font-size: 13px; }
/* ปุ่มคัดลอกคำตอบ: อยู่หน้าสุด เห็นชัด · .copying = ซ่อนปุ่ม/หัวโค้ดตอนอ่านข้อความไปคัดลอก */
.acts .cp-msg { color: var(--porcelain); border: 1px solid var(--steel); }
.copying button, .copying .code-h, .copying .mfiles { display: none !important; }
.imgp summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; } .imgp summary::-webkit-details-marker { display: none; } .imgp p { font-size: 13px; color: var(--ash); }
/* ตัวเลือกโมเดล: บรรทัด "เด่นด้าน" (note จากหลังบ้าน) เหนือป้ายความสามารถ */
.vtxt .vnote { display: block; margin: 1px 0 2px; color: var(--porcelain); opacity: .85; white-space: normal; line-height: 1.35; }
/* ลิงก์ติดต่อเราในเมนู: เด่นกว่ารายการอื่น หาเจอง่าย */
a.contact-l { color: var(--link) !important; border: 1px solid color-mix(in srgb, var(--link) 45%, transparent); border-radius: 12px; font-weight: 600; }
.zipbar { margin: 10px 0 2px; }
/* หน้า API: แท็บ + รายการ key แบบแถวเดียว ปุ่มชัด */
.devtabs { display: flex; width: max-content; max-width: 100%; margin: 0 auto 16px; overflow-x: auto; }
.klist { display: flex; flex-direction: column; gap: 8px; }
.krow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border: 1px solid var(--steel); border-radius: 14px; }
.krow .kinfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .krow .kinfo code { font-size: 12.5px; } .krow .kinfo .muted { font-size: 12.5px; }
.krow .kbtn { display: flex; gap: 6px; flex-wrap: wrap; }
.dv-status.ok { border-color: color-mix(in srgb, var(--green, #30d158) 45%, transparent); } .dv-status.warn { border-color: color-mix(in srgb, #f5b74e 60%, transparent); }
.dv-new { border-color: color-mix(in srgb, var(--link) 55%, transparent); }
/* แอป Desktop: ผลจากเครื่องที่ส่งกลับให้ AI (ย่อไว้) */
.msg.user.pcres details { max-width: 85%; border: 1px dashed var(--steel); border-radius: 14px; padding: 6px 12px; font-size: 13px; color: var(--ash); }
.msg.user.pcres summary { cursor: pointer; display: flex; gap: 6px; align-items: center; }
.msg.user.pcres pre { white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; margin: 6px 0 0; font-size: 12px; }
/* หลังบ้าน → ต้นทุนสด */
svg.spark rect { fill: var(--accent, #4b4fe0); opacity: .85; }
.pill.muted { opacity: .7; }
/* แอป Desktop: โหมด Agent (ขั้นตอนที่ Agent ทำในเครื่อง) */
.msg.ai .agent { margin: 0 0 8px; font-size: 13px; }
.agsteps > summary { cursor: pointer; color: var(--ash); display: flex; gap: 6px; align-items: center; padding: 4px 0; }
.agstep { border-left: 2px solid var(--steel); padding: 3px 0 3px 10px; margin: 2px 0; }
.agstep > summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agstep > summary code { opacity: .8; overflow: hidden; text-overflow: ellipsis; }
.agstep pre { white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; font-size: 12px; margin: 6px 0 2px; background: var(--carbon); padding: 8px; border-radius: 8px; }
.agstep .ok { color: var(--green); } .agstep .bad { color: var(--red); }
.agsp { width: 10px; height: 10px; border: 2px solid var(--steel); border-top-color: var(--accent, #4b4fe0); border-radius: 50%; display: inline-block; animation: agspin .8s linear infinite; }
@keyframes agspin { to { transform: rotate(360deg); } }
.agtodo { border: 1px solid var(--steel); border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; display: grid; gap: 3px; }
.agtodo .completed { opacity: .55; text-decoration: line-through; } .agtodo .in_progress { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .agsp { animation: none; } }
.agstep.sub { border-left-style: dashed; color: var(--ash); font-size: 12px; }
.agstep .agback { margin-left: auto; background: none; border: 0; color: var(--ash); cursor: pointer; padding: 0 4px; }
.agstep pre .dadd, .gitout .dadd, .rmt pre .dadd { color: var(--green); } .agstep pre .ddel, .gitout .ddel, .rmt pre .ddel { color: var(--red); }
.gitout { white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; font-size: 12px; background: var(--carbon); padding: 10px; border-radius: 10px; }
/* มือถือ: แผงสั่ง Agent ที่ทำงานบนคอม */
.rmt { margin: 8px auto; max-width: 760px; border: 1px solid var(--steel); border-radius: 14px; padding: 10px 12px; font-size: 13px; display: grid; gap: 8px; }
.rmt-h { display: flex; gap: 6px; align-items: center; } .rmt-ev { display: grid; gap: 2px; max-height: 220px; overflow: auto; }
.rmt-ev code { opacity: .8; } .rmt-ask { border: 1px solid var(--yellow, #e0af68); border-radius: 10px; padding: 8px; }
.rmt-ask pre { white-space: pre-wrap; max-height: 200px; overflow: auto; font-size: 12px; margin: 6px 0; }
.rmt-say input { flex: 1; }
.plug { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--steel); padding: 8px 0; }
.plug > div { flex: 1; min-width: 0; } .agtour ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.agask { border: 1px solid var(--yellow, #e0af68); border-radius: 12px; padding: 10px; margin: 6px 0; display: grid; gap: 8px; }
.agout { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; } .agout .fchip { cursor: pointer; border: 1px solid var(--steel); background: var(--carbon); }
.chk { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; }
/* หน้าแรก: ดาวน์โหลดแอปคอม */
.dl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; max-width: 1100px; margin: 0 auto; }
.dl-main { display: flex; flex-direction: column; align-items: flex-start; }
.dl-btn { font-size: 17px; padding: 14px 26px; gap: 8px; }
.dl-others { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin-bottom: 18px; }
.dl-feat { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.dl-feat li { display: flex; gap: 12px; align-items: flex-start; }
.dl-feat li > svg { flex: none; margin-top: 3px; color: var(--blue); }
.dl-feat b { display: block; font-weight: 600; }
.dl-feat span { font-size: 14px; }
.dl-shot { margin: 0; max-width: none; }
.dl-step { font: 500 13px/1.4 ui-monospace, 'JetBrains Mono', monospace; padding: 4px 0 4px 10px; border-left: 2px solid var(--steel); color: var(--porcelain); }
.dl-step b { color: var(--green); font-weight: 600; margin-right: 4px; }
.dl-step code { opacity: .7; background: none; padding: 0; }
.dl-step small { color: var(--ash); margin-left: 6px; }
@media (max-width: 820px) { .dl-grid { grid-template-columns: minmax(0, 1fr); } .dl-btn { align-self: stretch; justify-content: center; } }

/* ---------- แถบข้างแชตแบบใหม่: สลับ Chat / Code, ปุ่มแชตใหม่ด้านบน, เมนูบัญชีที่ชื่อผู้ใช้ (เมนูอื่นย้ายไปตั้งค่า) ---------- */
.side { gap: 8px; }
.side-top-acts { display: flex; align-items: center; gap: 2px; }
.side .side-x { display: none; }
@media (max-width: 760px) {
  .side { width: min(320px, 88vw); }
  .side .side-x { display: inline-flex; }
  .side .item a, .side-nav a, .side-nav button { min-height: 44px; }
}
.mode-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 9999px; background: rgba(var(--ov), .07); border: 1px solid var(--hair); }
.mode-seg button, .mode-seg a, .mode-seg span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 9999px; background: none; color: var(--ash); font: 500 14px var(--font); cursor: pointer; text-decoration: none; transition: background-color .15s, color .15s; }
@media (hover: hover) { .mode-seg button:not(.on):hover, .mode-seg a:not(.on):hover { color: var(--porcelain); } } /* มือถือ: hover ค้างหลังแตะ ไม่ทับสีปุ่มที่เลือก */
.mode-seg .on { background: var(--porcelain); color: var(--on-porcelain); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.mode-seg .on .ic, .mode-seg .on span { color: inherit; }
.mode-seg button span { color: inherit; }
.mode-seg .ic { width: 16px; height: 16px; }
.mode-seg.sm { display: inline-grid; margin: 18px auto 0; }
.mode-seg.sm span, .mode-seg.sm a { min-height: 36px; font-size: 13px; }
.side-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.side-pane[hidden] { display: none; }
.side-new { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 14px; background: var(--porcelain); color: var(--on-porcelain); font: 600 14px var(--font); text-decoration: none; transition: transform .12s; }
.side-new:hover { color: var(--on-porcelain); filter: brightness(.96); }
.side-new:active { transform: scale(.98); }
.side-new .ic { width: 16px; height: 16px; }
.side-nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--porcelain); font: 400 14px var(--font); text-align: left; cursor: pointer; transition: background-color .15s; }
.side-nav button:hover { background: rgba(var(--ov), .06); }
.side-nav button .ic { width: 16px; height: 16px; color: var(--ash); }
.side .item .pi { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side .item .pi b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .item .pi small { font-size: 11.5px; color: var(--ash); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { position: relative; }
.side-user { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; min-height: 48px; }
.side-user .su-t { flex: 1; }
.side-user .av.sm { background: var(--porcelain); color: var(--on-porcelain); border: 0; }
.side-user > .ic { width: 16px; height: 16px; color: var(--ash); flex: none; }
.side { position: relative; }
@media (max-width: 760px) { .side { position: fixed; } }
.acct-pop { position: absolute; left: 10px; right: 10px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 30; padding: 6px; border-radius: 18px; background: var(--carbon); border: 1px solid var(--hair); box-shadow: 0 18px 48px rgba(0,0,0,.35); animation: fadeUp .15s ease-out both; max-height: calc(100% - 90px); overflow: auto; }
.acct-pop [role=menuitem] { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--porcelain); font: 400 14px var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.acct-pop [role=menuitem]:hover, .acct-pop [role=menuitem]:focus-visible { background: rgba(var(--ov), .07); }
.acct-pop [role=menuitem] span { flex: 1; }
.acct-pop [role=menuitem] small { color: var(--ash); font-size: 13px; }
.acct-pop [role=menuitem] .ic { width: 17px; height: 17px; color: var(--ash); }
.acct-pop .ap-out, .acct-pop .ap-out .ic { color: var(--red, #e5484d); }
.acct-pop hr { border: 0; border-top: 1px solid var(--hair); margin: 6px 4px; }
.ap-head { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }
.ap-who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ash); }
.ap-who span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-who em { font-style: normal; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 9999px; background: rgba(75, 79, 224,.16); color: var(--link); }
.ap-bar { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 12px; color: var(--ash); }
.ap-bar i { grid-column: 1 / -1; height: 6px; border-radius: 9999px; background: rgba(var(--ov), .08); overflow: hidden; }
.ap-bar i b { display: block; height: 100%; border-radius: 9999px; background: var(--blue); }
.set-sheet h4 { margin: 14px 4px 6px; font: 600 12px var(--font); color: var(--ash); letter-spacing: .2px; }
.set-sheet h4:first-child { margin-top: 0; }
.set-sheet a.opt { text-decoration: none; }
:root[data-theme="light"] .acct-pop { background: #fff; box-shadow: 0 18px 48px rgba(31,26,22,.18); }
:root[data-theme="light"] .ap-who em { color: #8a3a1d; }
@media (prefers-reduced-motion: reduce) { .acct-pop { animation: none; } .side-new { transition: none; } }
/* บุ๊กมาร์กแชต: ดาวหน้าแชต (กดเพื่อยกเลิก) · หัวข้อ Recents มีปุ่ม + สร้างโฟลเดอร์ */
.side .bm-star { flex: none; width: 36px; height: 36px; margin-right: -6px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; cursor: pointer; opacity: 1; }
.side .item .bm-star { opacity: 1; }
.ic.bm-on { fill: #e8a33d; stroke: #e8a33d; color: #e8a33d; }
.side-sec { padding-right: 2px; }
.side-sec .icon-btn { width: 32px; height: 32px; }
.bm-row .opt-t { display: flex; align-items: center; gap: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-row.on { box-shadow: none; }
@media (max-width: 760px) { .side .bm-star { width: 40px; height: 44px; } .side-sec .icon-btn { width: 44px; height: 44px; } }
/* Spaces: รายการ Space และแชตในแต่ละ Space (ใน sheet) */
.spaces { display: flex; flex-direction: column; margin-top: 8px; }
.spaces .opt-t { display: flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-h { margin: 14px 4px 2px; font: 600 12px var(--font); color: var(--ash); }
.sp-del { margin-top: 10px; align-self: flex-start; color: var(--red, #e5484d); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; min-height: 0 !important; min-width: 0 !important; }

/* ---------- แถบข้างเดียวกับหน้าแชต ทุกหน้า (เมนู .nav เดิม) ---------- */
.nav .nav-panel { background-color: var(--graphite); border-right: 1px solid var(--hair); gap: 6px; padding: 14px 12px calc(12px + env(safe-area-inset-bottom)); -webkit-backdrop-filter: none; backdrop-filter: none; }
.nav .nav-head .logo, .nav .nav-top .logo { font: 700 17px var(--font); letter-spacing: .8px; text-transform: uppercase; }
.nav .nav-panel .mode-seg a { text-decoration: none; }
.nav .nav-panel .side-sec { padding: 10px 10px 2px; }
.nav-recents { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-recents p { padding: 6px 12px; margin: 0; font-size: 13px; }
.nav .nav-panel .nav-recents a.l { min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14px; gap: 10px; color: var(--porcelain); }
.nav .nav-panel .nav-recents a.l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .nav-panel .nav-recents a.l .ic { width: 16px; height: 16px; color: var(--ash); }
.nav .nav-panel .nav-recents a.l .ic.bm-on { color: #e8a33d; }
.nav .nav-panel a.l { border-radius: 12px; min-height: 44px; font-size: 14px; }
.nav .nav-panel .side-user { margin-top: 6px; padding: 8px 6px; border-top: 1px solid var(--hair); border-radius: 12px; display: flex; align-items: center; gap: 10px; color: var(--porcelain); }
.nav .nav-panel .side-user:hover { background: rgba(var(--ov), .06); }
.nav .nav-panel .acct-pop { bottom: calc(76px + env(safe-area-inset-bottom)); }
.nav .nav-r .nav-wal, .nav .nav-r .nav-av { display: none; } /* ยอดเงินและบัญชีอยู่ที่แถวผู้ใช้ในแถบข้าง */
@media (min-width: 1000px) {
  .view.with-side { padding-left: 280px; }
  .view.with-side > .nav .nav-panel { transform: none; width: 280px; transition: none; box-shadow: none; }
  .view.with-side > .nav .nav-scrim, .view.with-side > .nav .nav-x, .view.with-side > .nav .nav-top .nav-btn, .view.with-side > .nav .nav-top .logo { display: none; }
  .view.with-side > .nav .nav-top { background-color: rgba(var(--bg0), .7); border-bottom: 1px solid var(--hair); }
}
@media (max-width: 999px) { .nav .nav-panel { width: min(320px, 88vw); } }
.nav .nav-panel .side-user { flex: none; width: 100%; min-height: 52px; }
@media (min-width: 1000px) { .view.with-side > .nav .nav-r .btn { display: none; } } /* ยังไม่ล็อกอิน: ปุ่มเข้าสู่ระบบอยู่ในแถบข้างแล้ว */
/* หน้าตาสะอาดแบบหน้าแชต: พื้นผิวเรียบ เส้นขอบบาง เงาเบา (เฉพาะหน้าที่มีแถบข้างใหม่ · ไม่แตะหน้าแชต) */
.view.with-side .card, .view.with-side .tile, .view.with-side .showcase {
  background-image: none; background-color: var(--carbon); border: 1px solid var(--hair);
  -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.view.with-side .btn.out, .view.with-side .btn.dark, .view.with-side .tabs button, .view.with-side .tabs a, .view.with-side .chips button, .view.with-side .seg, .view.with-side .sc-pill {
  background-image: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 1px solid var(--hair);
}
.view.with-side .btn.out:hover, .view.with-side .btn.dark:hover, .view.with-side .tabs button:hover { background-color: rgba(var(--ov), .06); }
.view.with-side input, .view.with-side select, .view.with-side textarea { background: var(--carbon); border: 1px solid var(--hair); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
.view.with-side input:focus, .view.with-side select:focus, .view.with-side textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(75, 79, 224, .18); }
.view.with-side .btn.blue { box-shadow: none; }
.view.with-side .tile.plan.feat { box-shadow: 0 0 0 2px var(--porcelain); }
.view.with-side .hero h1, .view.with-side h1 { letter-spacing: -.01em; }
.nav .nav-panel { background-image: none; box-shadow: none; }
.nav.open .nav-panel { box-shadow: 0 18px 48px rgba(0, 0, 0, .3); }
@media (min-width: 1000px) { .view.with-side > .nav.open .nav-panel { box-shadow: none; } }
/* หน้าแรก (ยังไม่ล็อกอิน): ฟอร์มเข้าสู่ระบบ/สมัครอยู่ใน hero แทนปุ่ม */
.home-auth { width: 100%; max-width: 400px; margin: 8px auto 0; text-align: left; }
.auth-inline { padding: 0; margin: 0; max-width: none; }
.auth-inline .tabs { justify-content: center; margin-bottom: 12px; }
.auth-inline .card { margin: 0; background-image: none; background-color: var(--carbon); border: 1px solid var(--hair); box-shadow: 0 8px 28px rgba(0, 0, 0, .08); -webkit-backdrop-filter: none; backdrop-filter: none; }
.auth-inline h1 { font-size: 22px; text-align: center; margin: 0 0 12px; }

.mode-seg .on, .mode-seg .on:hover, .mode-seg .on:focus, .mode-seg .on span, .mode-seg .on .ic { color: var(--on-porcelain); } /* ปุ่มที่เลือก: ตัวหนังสือ/ไอคอนสีตรงข้ามพื้นเสมอ */
/* tools ของแชต: ปุ่มดาวน์โหลดไฟล์ที่ AI สร้าง, โค้ด Python ที่รัน และผลลัพธ์ */
.tool-cards { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.dl-card { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 420px; min-height: 56px; padding: 10px 14px; border: 1px solid var(--hair); border-radius: 14px; background: var(--carbon); color: var(--porcelain); font: inherit; text-align: left; cursor: pointer; }
.dl-card:hover { background: rgba(var(--ov), .05); }
.dl-card .ic { width: 20px; height: 20px; color: var(--blue); flex: none; }
.dl-card span { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.dl-card b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-card small { font-size: 12px; color: var(--ash); }
.pyrun { border: 1px solid var(--hair); border-radius: 12px; background: rgba(var(--ov), .03); }
.pyrun summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--ash); list-style: none; }
.pyrun pre { margin: 0; padding: 10px 12px; max-height: 320px; overflow: auto; font-size: 12.5px; background: #0e1116; color: #eef0f6; border-radius: 0 0 12px 12px; }
.pyout pre { margin: 0; padding: 10px 12px; max-height: 260px; overflow: auto; font-size: 12.5px; white-space: pre-wrap; border: 1px solid var(--hair); border-radius: 12px; background: var(--carbon); }
.pyout img { display: block; max-width: 100%; margin-top: 8px; border-radius: 12px; border: 1px solid var(--hair); background: #fff; }
/* ความจำที่บันทึกอัตโนมัติ: แถบเล็กใต้คำตอบ + ปุ่มยกเลิก · สวิตช์ในตั้งค่า */
.mem-saved { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 2px; padding: 6px 8px 6px 12px; border: 1px solid var(--hair); border-radius: 9999px; font-size: 13px; color: var(--ash); background: rgba(var(--ov), .03); max-width: 100%; }
.mem-saved .ic { width: 14px; height: 14px; color: var(--green, #1e8a3c); flex: none; }
.mem-saved span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-saved button { border: 0; background: none; color: var(--link); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 4px 6px; min-height: 32px; }
.set-toggle { cursor: pointer; }
.set-toggle input { grid-row: 1 / 3; grid-column: 2; align-self: center; width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--blue); }
/* หน้าต่างแบบเลื่อนขึ้น: พื้นทึบ อ่านง่าย (เดิมโปร่งจนเห็นตัวหนังสือด้านหลังซ้อน) */
:root .sheet, :root[data-lite] .sheet { background: var(--carbon); -webkit-backdrop-filter: none; backdrop-filter: none; }
/* ลิมิตการใช้งาน */
.ls { display: flex; flex-direction: column; gap: 10px; }
.ls-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ls-plan { font: 600 13px var(--font); padding: 4px 12px; border-radius: 9999px; background: rgba(75, 79, 224, .14); color: var(--link); }
.ls-card { padding: 14px 16px; border: 1px solid var(--hair); border-radius: 16px; background: rgba(var(--ov), .03); display: flex; flex-direction: column; gap: 8px; }
.ls-row { display: flex; align-items: baseline; justify-content: space-between; font-size: 14px; }
.ls-row b { font: 600 24px var(--font); letter-spacing: -.01em; }
.ls-bar { height: 8px; border-radius: 9999px; background: rgba(var(--ov), .1); overflow: hidden; }
.ls-bar i { display: block; height: 100%; border-radius: 9999px; background: var(--blue); transition: width .4s ease; }
.ls-card.hi .ls-bar i { background: var(--yellow, #d9a400); }
.ls-card.full .ls-bar i { background: var(--red, #e5484d); }
.ls-card.full .ls-row b { color: var(--red, #e5484d); }
.ls-card small { font-size: 12.5px; color: var(--ash); }
.ls-note { font-size: 12.5px; margin: 0; }
.ls-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.ls-acts .btn { width: 100%; justify-content: center; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .ls-bar i { transition: none; } }
.sheet .btn.out { background-image: none; background-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 1px solid var(--hair); }
.sheet .btn.out:hover { background-color: rgba(var(--ov), .06); }

/* Code: หน้าเริ่มโปรเจกต์ใหม่ (แบบ Claude Code) */
.cstart { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px 48px; }
.cs-in { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.cs-h { margin: 0; text-align: center; font: 500 clamp(26px, 5vw, 34px)/1.3 var(--display); letter-spacing: -.01em; }
.cs-box.cbox { display: block; background: var(--carbon); border: 1px solid var(--hair); border-radius: 22px; padding: 8px 10px 10px; box-shadow: 0 6px 24px rgba(31, 26, 22, .08); backdrop-filter: none; -webkit-backdrop-filter: none; }
.cs-box textarea { min-height: 72px; resize: none; width: 100%; }
.cs-box .cb { background: transparent; border-color: var(--hair); }
.cs-ideas { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cs-idea { height: 36px; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--hair); background: transparent; color: var(--porcelain); font: 500 13px var(--font); cursor: pointer; }
@media (hover: hover) { .cs-idea:hover { background: var(--graphite); } }
.cs-foot { margin: 0; text-align: center; color: var(--ash); font-size: 13px; }
.cs-foot .linkish { font-size: 13px; }
@media (max-width: 420px) { .cs-lbl { display: none; } }
.plist { display: flex; flex-direction: column; gap: 2px; }
.prow { display: flex; align-items: center; gap: 6px; padding: 8px 6px; border-radius: 12px; }
.prow > a, .prow > span { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.prow b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .prow:hover { background: var(--graphite); } }
.view.with-side .cs-box textarea, .view.with-side .cs-box textarea:focus { border: 0; background: transparent; box-shadow: none; outline: none; padding: 8px 8px 4px; border-radius: 0; }
.cs-box:focus-within { border-color: var(--steel); }
.cs-in .err:empty { display: none; }

/* Chat + Code ในหน้าเดียว: ฝั่งขวาของโหมด Code */
.cmain { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; background: var(--obsidian); }
.cmain > .ide { position: absolute; inset: 0; }
.cs-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.cs-bar { border-bottom: 0; }
.cs-bar .ctitle { flex: 1; }
.cs-load { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; }
.cmain .cs-box textarea, .cmain .cs-box textarea:focus { border: 0; background: transparent; box-shadow: none; outline: none; padding: 8px 8px 4px; border-radius: 0; }
.side-nav button { width: 100%; }

/* Code: หน้าโปรเจกต์แบบแชตเป็นหลัก (แบบ Claude Code) */
.rp-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9999px; background: rgba(var(--ov), .06); flex: none; }
.rp-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 9999px; background: transparent; color: var(--ash); font: 500 13px var(--font); cursor: pointer; }
.rp-tabs button.on { background: var(--carbon); color: var(--porcelain); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
@media (hover: hover) { .rp-tabs button:not(.on):hover { color: var(--porcelain); } }
@media (min-width: 1000px) {
  .ide[data-layout="chat"] .ide-body { grid-template-columns: minmax(360px, 1fr) minmax(0, 1.2fr); }
  .ide[data-layout="chat"] .ide-ai { grid-column: 1; grid-row: 1; border-left: 0; border-right: 1px solid var(--hair); }
  .ide[data-layout="chat"] .ide-files, .ide[data-layout="chat"] .ide-main { grid-column: 2; grid-row: 1; }
  .ide[data-layout="chat"]:not([data-rp="files"]) .ide-files { display: none; }
  .ide[data-layout="chat"][data-rp="files"] .ide-main { display: none; }
  .ide[data-layout="chat"][data-rp="files"] .ide-files { border-right: 0; }
  .ide[data-layout="chat"][data-rp="code"] .ide-run { display: none; }
  .ide[data-layout="chat"][data-rp="preview"] .ide-main > :not(.ide-run) { display: none; }
  .ide[data-layout="chat"][data-rp="preview"] .ide-run { display: flex; flex: 1; height: auto; border-top: 0; }
  .ide[data-layout="chat"] #aiclose, .ide[data-layout="chat"] .ide-burger { display: none; }
  .ide[data-layout="chat"] .ide-ai .msgs, .ide[data-layout="chat"] .ide-ai .compose { width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 999px) { .rp-tabs { display: none; } }
.tsteps { margin: 2px 0 8px; border: 1px solid var(--hair); border-radius: 12px; background: rgba(var(--ov), .03); font-size: 13px; }
.tsteps summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; color: var(--ash); min-height: 38px; }
.tsteps summary::-webkit-details-marker { display: none; }
.tsteps summary > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsteps .tchev { transition: transform .15s; flex: none; }
.tsteps[open] .tchev { transform: rotate(90deg); }
.tsteps ol { list-style: none; margin: 0; padding: 0 12px 10px; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.tsteps li { display: flex; align-items: center; gap: 8px; color: var(--porcelain); font-size: 12px; }
.tsteps li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsteps li .ic { color: var(--green); flex: none; }
.tsteps li.bad, .tsteps li.bad .ic { color: var(--red); }
.tdot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; animation: tpulse .9s ease-in-out infinite alternate; }
@keyframes tpulse { to { opacity: .25; } }
.pushnote { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 12px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; font-size: 13px; }
.pushnote > .ic, .pushnote > .tdot { margin-top: 4px; flex: none; }
.pushnote > span { flex: 1; min-width: 0; }
.pushnote small { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pushnote.st-ok > .ic { color: var(--green); }
.pushnote.st-bad > .ic { color: var(--red); }
.gauto { margin: 10px 0; }
.chg .cpath[data-openf] { cursor: pointer; } @media (hover: hover) { .chg .cpath[data-openf]:hover { text-decoration: underline; } }
.imp-skip { border: 1px solid var(--hair); border-radius: 12px; padding: 8px 12px; } .imp-skip summary { cursor: pointer; } .imp-skip ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; max-height: 200px; overflow: auto; word-break: break-all; }
/* Code: รายการงานสด · โหมด Plan · session · PR */
.todos { margin: 2px 0 8px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; background: var(--carbon); font-size: 13.5px; }
.td-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; } .td-h b { flex: 1; font-weight: 600; } .td-h .ic { color: var(--ash); }
.todos ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.todos li { display: flex; align-items: flex-start; gap: 8px; line-height: 1.45; }
.todos li i { flex: none; width: 15px; height: 15px; margin-top: 2px; border: 1.5px solid var(--ash); border-radius: 4px; position: relative; }
.todos li.td-in_progress i { border-color: var(--blue); background: radial-gradient(circle, var(--blue) 0 3px, transparent 3.5px); animation: tpulse .9s ease-in-out infinite alternate; }
.todos li.td-in_progress span { font-weight: 600; }
.todos li.td-completed i { border-color: var(--green); background: var(--green); }
.todos li.td-completed i::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.todos li.td-completed span { color: var(--ash); text-decoration: line-through; }
.plan-go { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; padding: 10px 12px; border: 1px dashed var(--blue); border-radius: 12px; }
.plan-go .muted { font-size: 12.5px; }
.cb.cperm[data-perm="plan"] { border-color: var(--blue); color: var(--blue); }
.cb.cperm[data-perm="ask"] { border-color: var(--yellow); }
.sess { display: flex; flex-direction: column; gap: 1px; margin: 0 0 6px 22px; padding-left: 8px; border-left: 1px solid var(--hair); }
.sess a { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; color: var(--porcelain); font-size: 13px; min-height: 34px; }
.sess a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess .sess-new { color: var(--ash); } .sess a.on { background: var(--carbon); font-weight: 600; }
@media (hover: hover) { .sess a:hover { background: rgba(var(--ov), .06); } }
.gmode { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; font-size: 13px; } .gmode .seg { margin: 0; }
.pushnote .pn-pr { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; }
.crow:has(> .send) > #cperm { flex: none; } .crow:has(> .send) > #cperm span { display: inline; }
/* มือถือ: ปุ่มในช่องพิมพ์โหมด Code มีหลายปุ่ม · ชื่อโมเดลต้องอ่านออก ส่วนระดับคิด/โหมดเหลือแค่ไอคอน (แตะแล้วเห็นชื่อเต็ม) */
@media (max-width: 560px) { .crow:has(> .send) > #cmdl { flex: 1 1 auto; min-width: 104px; } .crow:has(> .send) > #ceff span, .crow:has(> .send) > #cperm span, .crow:has(> .send) > #ceff > svg:last-child, .crow:has(> .send) > #cperm > svg:last-child { display: none; } }
.dl-note { font-size: 13px; margin: -6px 0 14px; }

/* ตั้งค่า → Connectors / Skills / Plugins */
.sheet.cn-sheet { width: min(960px, 96vw); max-width: none; }
.sheet.cn-sheet.cn-main { height: min(80dvh, 760px); } /* ความสูงคงที่ สลับแท็บแล้วหน้าต่างไม่ยืดหด */
@media (min-width: 700px) { .sheet.cn-sheet { height: min(820px, 88dvh); } .sheet.cn-sheet .sheet-b { overflow: auto; } }
.cn-wrap { display: flex; flex-direction: column; gap: 12px; }
.cn-top .seg, .cn-bar .seg { margin: 0; }
.cn-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cn-bar input[type=search] { flex: 1; min-width: 140px; min-height: 38px; }
.cn-cat { margin: 10px 0 2px; font-size: 13px; color: var(--ash); font-weight: 600; }
.cn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.cn-card, .cn-row { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--hair); border-radius: 14px; background: var(--carbon); color: var(--porcelain); text-align: left; font: inherit; cursor: pointer; }
.cn-row { align-items: center; padding: 10px 12px; }
@media (hover: hover) { .cn-card:hover, .cn-row:hover { border-color: var(--steel); } }
.cn-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--c, #6b7280); color: #fff; font: 700 16px var(--font); overflow: hidden; }
.cn-ico.big { width: 48px; height: 48px; border-radius: 12px; font-size: 20px; }
.cn-ico img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cn-ico .ic { color: #fff; }
.cn-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cn-txt b { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cn-txt span { font-size: 13px; color: var(--ash); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cn-txt small { font-size: 12px; color: var(--ash); }
.cn-ok .ic { color: var(--green); }
.cn-plus { flex: none; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--hair); display: inline-flex; align-items: center; justify-content: center; }
.cn-list { display: flex; flex-direction: column; gap: 8px; }
.cn-row .pill { flex: none; } .pill.ok { color: var(--green); } .pill.bad { color: var(--red); }
.cn-empty { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cn-empty p { margin: 0; max-width: 460px; }
.cn-head { display: flex; align-items: center; gap: 12px; } .cn-head b { font-size: 18px; display: block; } .cn-head small { color: var(--ash); }
.cn-back { align-self: flex-start; }
.cn-form { display: flex; gap: 8px; flex-wrap: wrap; } .cn-form input { flex: 1; min-width: 200px; }
.cn-hint { font-size: 12.5px; margin: 0; }
.cn-acts { gap: 8px; flex-wrap: wrap; }
.cn-tools { display: flex; flex-direction: column; gap: 6px; }
.cn-tool { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--hair); border-radius: 10px; flex-wrap: wrap; }
.cn-tool > div:first-child { min-width: 0; flex: 1 1 200px; } .cn-tool b { font: 500 13px var(--mono, monospace); word-break: break-all; } .cn-tool small { display: block; color: var(--ash); font-size: 12px; }
.seg.sm { margin: 0; } .seg.sm button { min-height: 30px; padding: 0 10px; font-size: 12px; }
.cn-pre { white-space: pre-wrap; max-height: 320px; overflow: auto; font-size: 12.5px; background: var(--obsidian); border: 1px solid var(--hair); border-radius: 10px; padding: 10px; }
/* ปุ่มอนุญาตเครื่องมือในแชต */
.approve { border: 1px solid var(--blue); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.approve:not(.pending) { border-color: var(--hair); }
.approve .ap-h { display: flex; align-items: center; gap: 6px; }
.ap-args { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; max-height: 180px; overflow: auto; word-break: break-word; }
.ap-btns { display: flex; gap: 6px; flex-wrap: wrap; }
/* หน้าปิดป๊อปอัปหลังล็อกอิน */
.connected { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--obsidian); color: var(--porcelain); font-family: var(--font); }
.cn-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 360px; }
.cn-done h1 { margin: 0; font: 600 22px var(--font); }
.cn-mark { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 26px var(--font); color: #fff; background: var(--ash); }
.cn-mark.ok { background: var(--green); } .cn-mark.bad { background: var(--red); }
.cn-row.cn-static { cursor: default; } .cn-line { font-size: 13.5px; padding: 4px 0; } .cn-line b { font-weight: 600; }
.cn-ico.logo { background: #fff; border: 1px solid var(--hair); padding: 7px; } .cn-ico.big.logo { padding: 10px; }
.cn-ico.logo svg { width: 100%; height: 100%; display: block; }
/* โหมด Code: แถบกำลังทำงานใต้ข้อความ AI */
.cwork { display: flex; align-items: center; gap: 8px; padding: 6px 16px 8px; font-size: 13px; color: var(--ash); }
.cwork[hidden] { display: none; }
.cwork .muted { margin-left: auto; font-variant-numeric: tabular-nums; }
.cw-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #4b4fe0); flex: none; animation: cwpulse 1.1s ease-in-out infinite; }
@keyframes cwpulse { 50% { opacity: .25; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .cw-dot { animation: none; } }

/* โหมด Code ครั้งแรก: เลือก repo แตะเดียว */
.repo-pick { display: flex; flex-direction: column; gap: 6px; max-height: 40dvh; overflow: auto; }
.repo-it { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; background: none; color: inherit; font: inherit; cursor: pointer; }
.repo-it:hover { background: rgba(var(--ov, 255,255,255), .05); }
.repo-it span { display: flex; flex-direction: column; min-width: 0; flex: 1; } .repo-it b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-it small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .repo-it .pill { font-style: normal; flex: none; }
/* ต้นไม้ไฟล์ (โหมด Code): เส้นแนวตั้งต่อระดับโฟลเดอร์ ให้เห็นว่าไฟล์อยู่ในโฟลเดอร์ไหน · แถวเตี้ยลงครึ่งหนึ่ง
   (คลาส .trow ใช้ร่วมกับเมนูเครื่องมือในแชตที่มี padding ใหญ่ จึงต้องกำหนดเฉพาะใน #tree) */
#tree .trow { gap: 2px; padding-top: 0; padding-bottom: 0; padding-right: 0; border-radius: 6px; min-height: 26px;
  background-image: repeating-linear-gradient(90deg, transparent 0 7px, var(--hair) 7px 8px, transparent 8px 14px);
  background-size: calc(var(--d, 0) * 14px) 100%; background-repeat: no-repeat; background-position: 6px 0; }
#tree .trow:hover { background-color: rgba(var(--ov), .05); }
#tree .tname, .ide #tree .tname, .ide .ide-files #tree .tname { min-height: 26px; padding: 2px 4px; font-size: 13px; line-height: 1.3; gap: 4px; }
#tree .tname .ic { width: 15px; height: 15px; }
#tree .tmore, .ide #tree .tmore { width: 26px; height: 26px; min-height: 26px; opacity: .6; }

/* หน้า New project (โหมด Code): ชิปเลือก repo เหนือช่องพิมพ์ แบบ Claude Code */
.repo-row { display: flex; gap: 8px; width: 100%; max-width: 720px; margin: 0 auto 8px; }
.repo-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--hair); border-radius: 999px; background: none; color: var(--ash); font: 500 14px var(--font); cursor: pointer; max-width: 100%; }
.repo-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-chip.on { color: var(--porcelain); border-color: var(--steel); }
.repo-chip .rc-x { display: inline-flex; margin-left: 2px; opacity: .6; }
.repo-chip .rc-x:hover { opacity: 1; }
.seo-static{max-width:720px;margin:0 auto;padding:24px 16px;line-height:1.6}
.seo-static h1{font-size:22px}.seo-static h2{font-size:17px}
.art-card { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; background: rgba(255,255,255,.03); color: inherit; text-align: left; cursor: pointer; }
.art-card:hover { border-color: var(--accent, #6b6ff5); }
.art-card span { display: flex; flex-direction: column; min-width: 0; }
.art-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-card small { color: var(--muted, #9aa0aa); font-size: 12px; }
.cv-v { width: auto; padding: 2px 6px; font-size: 13px; }
#cv-sh.on { border-color: #3fb950; color: #3fb950; }
.cv-h b#cv-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
.code-h .art-up { margin-right: 4px; color: var(--accent, #6b6ff5); }
@media (max-width: 520px) { .code-h .art-up { font-size: 0; } .code-h .art-up .ic { font-size: 14px; } }
/* ความสมูธ: ปิดชีต/เมนูแบบเลื่อนลง, ข้อความใหม่ในแชตค่อย ๆ ขึ้น, ปุ่มยุบเล็กน้อยตอนกด */
.sheet-bg.out { animation: fadeOut .18s ease-in both; }
.sheet-bg.out .sheet { animation: sheetDown .18s ease-in both; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetDown { to { transform: translateY(30px); opacity: 0; } }
#msgs > .msg.enter { animation: fadeUp .22s ease-out backwards; }
.btn, .icon-btn, .opt, .art-card { transition: transform .12s ease, background-color .15s ease, border-color .15s ease; }
.btn:active, .icon-btn:active, .opt:active, .art-card:active { transform: scale(.97); }
#msgs { overflow-anchor: auto; }
/* แถบข้าง: เน้นระบบงาน (Workspace / Artifacts เป็นไทล์ใหญ่) */
.work-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 2px 0 10px; }
.work-tiles.one { grid-template-columns: 1fr; }
.wtile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 96px; padding: 14px; border: 1px solid var(--hair); border-radius: 16px; background: rgba(var(--ov), .04); color: var(--porcelain); text-align: left; cursor: pointer; }
.wtile:hover { background: rgba(var(--ov), .08); }
.wtile .ic { width: 24px; height: 24px; color: var(--blue); margin-bottom: 4px; }
.wtile b { font: 600 18px var(--font); line-height: 1.2; }
.wtile small { color: var(--ash); font-size: 12px; line-height: 1.3; }
.side-nav:empty { display: none; }
/* Workspace sheet */
.ws-new { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1.5px dashed var(--hair); border-radius: 16px; background: none; color: var(--porcelain); text-align: left; cursor: pointer; }
.ws-new:hover { border-color: var(--blue); }
.ws-new > .ic { width: 22px; height: 22px; color: var(--blue); }
.ws-new span, .ws-t { display: flex; flex-direction: column; min-width: 0; }
.ws-new small, .ws-t small { color: var(--ash); font-size: 12.5px; }
.ws-grid { display: grid; gap: 8px; }
.ws-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--hair); border-radius: 16px; background: rgba(var(--ov), .03); color: var(--porcelain); text-align: left; cursor: pointer; }
.ws-card:hover { background: rgba(var(--ov), .07); }
.ws-ic { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--blue); color: #fff; font: 600 18px var(--font); }
.ws-t { flex: 1; } .ws-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ws-card > .ic { color: var(--ash); }
/* แหล่งที่มาจากการค้นเว็บ: ย่อเป็นแถบเดียว แตะเพื่อดู */
.srcbox { margin: 8px 0 0; }
.srcbox > summary { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 9999px; background: var(--carbon); color: var(--ash); font-size: 13px; cursor: pointer; list-style: none; }
.srcbox > summary::-webkit-details-marker { display: none; }
.srcbox[open] > summary > .ic:last-child { transform: rotate(180deg); }
.src-fav { display: inline-flex; }
.src-fav i { display: grid; place-items: center; width: 18px; height: 18px; margin-left: -5px; border-radius: 50%; background: var(--steel); color: var(--porcelain); font: 600 10px var(--font); font-style: normal; border: 1.5px solid var(--carbon); }
.src-fav i:first-child { margin-left: 0; }
.wtile, .ws-new, .ws-card, .art-card, .srcbox > summary { font-family: var(--font); }
.wtile b, .wtile small, .ws-new b, .ws-new small, .ws-t b, .ws-t small, .ws-ic { font-family: var(--font); }
/* ไทล์/ชีต Workspace + Artifacts: ใช้ Inter + Prompt (ภาษาไทยสวยกว่าฟอนต์ระบบ) */
.wtile, .ws-new, .ws-card, .art-card, .srcbox > summary, .sheet-form.ws, .sheet-form.ws .sheet-msg, .ws-ic { font-family: 'Inter', 'Prompt', system-ui, sans-serif; }
.ws-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ws-tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border: 1px solid var(--hair); border-radius: 14px; background: rgba(var(--ov), .03); color: var(--porcelain); text-align: left; cursor: pointer; font-family: 'Inter', 'Prompt', system-ui, sans-serif; }
.ws-tpl:hover { border-color: var(--blue); }
.ws-tpl > span { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.ws-tpl b { font-size: 14px; } .ws-tpl small { color: var(--ash); font-size: 12px; }
.value-card { max-width: 640px; margin: 0 auto 20px; padding: 18px; font-family: 'Inter', 'Prompt', system-ui, sans-serif; }
.vc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.vc-r { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 14px; }
.vc-r s { color: var(--ash); } .vc-t { border-top: 1px solid var(--hair); margin-top: 4px; padding-top: 8px; font-weight: 600; }
.vc-us { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 14px; border-radius: 16px; background: rgba(75, 79, 224,.1); }
.vc-us b { font: 600 32px var(--font); color: var(--blue); } .vc-us span { font-size: 13px; }
.vc-us em { font-style: normal; font-weight: 600; color: #2f9e5b; margin-top: 4px; }
@media (max-width: 520px) { .vc-cols { grid-template-columns: 1fr; } }
.ann.promo { background: linear-gradient(90deg, rgba(75, 79, 224,.18), rgba(75, 79, 224,.06)); }
.tp-box { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: rgba(75, 79, 224,.12); color: var(--porcelain); font-size: 14px; }
.sch-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px; border: 1px solid var(--hair); border-radius: 16px; background: rgba(var(--ov), .03); font-family: 'Inter', 'Prompt', system-ui, sans-serif; }
.sch-card.off { opacity: .55; }
.sch-t { display: flex; flex-direction: column; min-width: 0; } .sch-t b { font-size: 15px; } .sch-t small { font-size: 12.5px; color: var(--ash); } .sch-t small.bad { color: #e5534b; }
.sch-acts { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.catts { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 6px 0; }
.catt { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 220px; border: 1px solid var(--hair); border-radius: 10px; background: rgba(var(--ov), .04); font-size: 12.5px; }
.catt img { width: 52px; height: 52px; object-fit: cover; border-radius: 9px; display: block; }
.catt.f { padding: 6px 26px 6px 8px; } .catt.f b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.catt button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--porcelain); color: var(--on-porcelain); font-size: 13px; line-height: 1; cursor: pointer; }
.pm-chip.free { border-color: rgba(47,158,91,.5); background: rgba(47,158,91,.1); }
.pm-chip.free b, .vfree { color: #2f9e5b; font-weight: 600; }
.vfree { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: rgba(47,158,91,.12); white-space: nowrap; }

.cc-pill { display: inline-block; margin: 6px 0 0; padding: 5px 10px; border-radius: 10px; background: rgba(75, 79, 224,.12); color: var(--porcelain); font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.cc-pill small { display: block; font-weight: 400; color: var(--ash); font-size: 11.5px; }
.cc-sw { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-weight: 400; cursor: pointer; }
.cc-sw input { width: auto; margin-top: 3px; }

.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 32px; }
.gal-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--hair); border-radius: 16px; background: rgba(var(--ov), .03); color: inherit; text-decoration: none; }
.gal-card:hover { border-color: var(--blue); }
.gal-ic .ic { width: 22px; height: 22px; color: var(--blue); }
.gal-card b { font-size: 15px; }

.lintbar { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px; border-top: 1px solid rgba(229,83,75,.35); background: rgba(229,83,75,.08); max-height: 96px; overflow: auto; }
.lintbar button { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border: 0; border-radius: 6px; background: none; color: #f08c86; font: 12.5px ui-monospace, Menlo, monospace; text-align: left; cursor: pointer; }
.lintbar button:hover { background: rgba(229,83,75,.12); }
.lintbar button b { color: #ffb3ae; font-weight: 600; white-space: nowrap; }

.sec-b { margin: 0 0 22px; padding: 18px 20px; border: 1px solid var(--hair); border-radius: 16px; }
.sec-b h2 { margin: 0 0 8px; font-size: 18px; } .sec-b ul { margin: 0; padding-left: 20px; line-height: 1.7; }
.ws-team { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: rgba(47,158,91,.15); color: #2f9e5b; font-size: 11px; font-weight: 600; vertical-align: 2px; }
.seat-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.seat-row b { min-width: 2ch; font-size: 20px; }
.seat-row small { flex-basis: 100%; }
.ws-tpl > span.ws-tpl-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(75, 79, 224,.12); margin-bottom: 6px; }
.ws-tpl-ic .ic { width: 18px; height: 18px; color: var(--blue); }

.canvas.is-file [data-cv], .canvas.is-file #cv-cp, .canvas.is-file #cv-tc, .canvas.is-file #cv-dl { display: none; }
.cv-s { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; background: rgb(var(--bg1)); }
.uf-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: rgb(var(--bg1)); border-bottom: 1px solid rgba(var(--ov),.12); font-size: 13px; }
.uf-bar .sp { flex: 1; }
.uf-live { color: #2f9e5b; }
.uf-tabs { display: flex; gap: 4px; padding: 6px 12px 0; overflow-x: auto; }
.uf-tabs button { border: 1px solid rgba(var(--ov),.12); border-bottom: 0; background: none; color: inherit; padding: 5px 12px; border-radius: 8px 8px 0 0; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.uf-tabs button.on { background: rgba(var(--ov),.08); font-weight: 600; }
.uf-grid { overflow: auto; flex: 1; }
.uf-grid table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.uf-grid th, .uf-grid td { border: 1px solid rgba(var(--ov),.12); padding: 4px 8px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; height: 26px; }
.uf-grid thead th, .uf-grid tbody th { background: rgba(127,127,127,.1); color: var(--ash); font-weight: 500; position: sticky; font-size: 12px; }
.uf-grid thead th { top: 0; z-index: 1; }
.uf-grid tbody th { left: 0; text-align: right; }
.uf-grid tr.hd td { font-weight: 700; background: rgba(90,130,200,.14); }
.uf-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.uf-grid td.fx { color: #2f6fd6; }
.uf-grid td { cursor: cell; }
.uf-in { width: 100%; min-width: 80px; border: 0; outline: 2px solid #2f6fd6; background: rgb(var(--bg1)); color: inherit; font: inherit; padding: 2px 4px; }
.uf-doc { padding: 16px 20px; max-width: 820px; }
.uf-ta { flex: 1; margin: 10px 12px; min-height: 60vh; font: 14px/1.6 ui-monospace, Consolas, monospace; background: rgb(var(--bg1)); color: inherit; border: 1px solid rgba(var(--ov),.12); border-radius: 8px; padding: 12px; }
.canvas.is-file .cv-h { background: rgb(var(--bg1)); color: var(--porcelain); border-bottom: 1px solid rgba(var(--ov),.12); }
.canvas.is-file .cv-h select { color: inherit; background: transparent; }
.uf-slides { padding: 14px; display: grid; gap: 14px; }
.uf-slide { position: relative; aspect-ratio: 16/9; overflow: auto; background: #fff; color: #1f2937; border-radius: 10px; border-top: 6px solid #6b6ff5; padding: 18px 26px; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-size: 14px; }
.uf-slide h3 { margin: 0 0 10px; font-size: 22px; }
.uf-slide small { position: absolute; right: 12px; bottom: 8px; color: #9ca3af; }
.uf-slide table { border-collapse: collapse; } .uf-slide td, .uf-slide th { border: 1px solid #ccc; padding: 3px 8px; }
.task-todo { margin: 6px 0 10px; padding: 10px 14px; border: 1px solid rgba(var(--ov),.12); border-radius: 12px; font-size: 13.5px; display: grid; gap: 3px; }
.task-todo b { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.task-todo .tt.completed { color: var(--ash); text-decoration: line-through; }
.task-todo .tt.in_progress { font-weight: 600; color: var(--blue); }
.task-tpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.task-tpl button { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid rgba(var(--ov),.14); border-radius: 10px; background: none; color: inherit; font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.task-tpl button:hover { background: rgba(var(--ov),.06); }
.task-fold { margin-left: 8px; }
/* ---------- โหมด Cowork: บทสนทนาตรงกลาง + แผง Progress / Artifacts / Context ด้านขวา ---------- */
.mode-seg button span { white-space: nowrap; }
.mode-seg button, .mode-seg a, .mode-seg span { padding: 0 8px; }
.cwmain { flex: 1; min-width: 0; display: flex; background: var(--obsidian); }
.cw { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; height: 100dvh; }
.cw.cw-empty { grid-template-columns: minmax(0, 1fr); }
.cw.cw-empty .cw-side { display: none; }
.cw-conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--hair); }
.cw-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.cw-bar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 15px var(--display); }
.cw-model { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ash); border: 1px solid var(--hair); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.cw-paneb { display: none; }
.cw-msgs { flex: 1; overflow-y: auto; padding: 20px max(16px, calc(50% - 380px)) 12px; display: flex; flex-direction: column; gap: 12px; }
.cw-msgs .msg.user { align-self: flex-end; max-width: 85%; }
.cw-msgs .msg.user .b { white-space: pre-wrap; }
.cw-say { line-height: 1.65; }
.cw-say > :first-child { margin-top: 0; }
.cw-think summary, .cw-tool summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cw-think summary::-webkit-details-marker, .cw-tool summary::-webkit-details-marker { display: none; }
.cw-think { color: var(--ash); font-size: 13px; }
.cw-think p { white-space: pre-wrap; margin: 6px 0 0 22px; }
.cw-tool { border: 1px solid var(--hair); border-radius: 12px; padding: 9px 12px; background: rgba(var(--ov), .03); }
.cw-tool summary small { color: var(--ash); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.cw-tool.ok > summary .ic { color: #2f9e5b; } .cw-tool.bad > summary .ic { color: var(--red); }
.cw-req { margin-top: 8px; display: grid; gap: 4px; }
.cw-req pre { margin: 0; max-height: 260px; overflow: auto; padding: 10px; border-radius: 8px; background: rgba(var(--ov), .06); font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.cw-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(var(--ov), .2); border-top-color: var(--blue); animation: cwspin .8s linear infinite; flex: none; display: inline-block; }
@keyframes cwspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cw-spin { animation-duration: 3s; } }
.cw-working { display: flex; align-items: center; gap: 8px; color: var(--ash); font-size: 13.5px; }
.cw-info { font-size: 13px; margin: 0; } .cw-info.bad { color: var(--red); }
.cw-shot img { max-width: 100%; border-radius: 10px; border: 1px solid var(--hair); }
.cw-shot { margin: 0; } .cw-shot figcaption { font-size: 12px; }
.cw-ask { border: 1px solid var(--blue); border-radius: 12px; padding: 12px; display: grid; gap: 8px; } .cw-ask div { display: flex; gap: 6px; flex-wrap: wrap; }
.cw-box { margin: 0 max(16px, calc(50% - 380px)); border: 1px solid var(--hair); border-radius: 18px; padding: 8px 10px; background: rgba(var(--ov), .04); }
.cw-box textarea, .cw-box textarea:focus { width: 100%; border: 0; background: transparent; box-shadow: none; outline: none; resize: none; padding: 6px 4px; font: 15px/1.5 var(--font); color: inherit; max-height: 220px; }
.cw-acts { display: flex; align-items: center; gap: 6px; }
.cw-acts .sp { flex: 1; }
.cw-acts .send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--porcelain); color: var(--on-porcelain); cursor: pointer; display: grid; place-items: center; }
.cw-acts .send.stop { background: var(--red); color: #fff; }
.cw-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cw-chips .fchip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; display: inline-flex; }
.cw-foot { text-align: center; font-size: 11.5px; margin: 6px 0 10px; }
.cw-hello { margin: auto; max-width: 640px; text-align: center; display: grid; gap: 10px; justify-items: center; padding: 20px 0; }
.cw-hello h2 { margin: 6px 0 0; font: 600 26px var(--display); }
.cw-logo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: rgba(var(--ov), .07); color: var(--blue); }
.cw-logo .ic { width: 26px; height: 26px; }
.cw-tpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; width: 100%; margin-top: 10px; text-align: left; }
.cw-tpl button { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--hair); border-radius: 14px; background: none; color: inherit; font: inherit; cursor: pointer; }
.cw-tpl button:hover { background: rgba(var(--ov), .05); }
.cw-tpl button b { font-size: 14px; display: flex; align-items: center; gap: 6px; } .cw-tpl button .ic { color: var(--blue); }
.cw-tpl small { color: var(--ash); font-size: 12px; line-height: 1.45; }
.cw-side { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: rgba(var(--ov), .02); }
.cw-side details { border: 1px solid var(--hair); border-radius: 14px; padding: 10px 12px; background: rgb(var(--bg1)); }
.cw-side summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.cw-side details > div { margin-top: 10px; display: grid; gap: 4px; font-size: 13px; }
.cw-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.cw-dots span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(var(--ov), .25); display: grid; place-items: center; }
.cw-dots .completed { border-color: #2f9e5b; color: #2f9e5b; } .cw-dots .in_progress { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(75, 79, 224,.18); }
.cw-steps { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.cw-steps .completed { color: var(--ash); text-decoration: line-through; } .cw-steps .in_progress { font-weight: 600; }
.cw-file { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.cw-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .cw-file small { color: var(--ash); }
.cw-file:hover:not(.static) { background: rgba(var(--ov), .06); } .cw-file.static { cursor: default; }
.cw-side small.muted { display: block; margin-top: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.cw-new { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.cw-new .ic { color: #fff; background: var(--blue); border-radius: 50%; padding: 3px; width: 20px; height: 20px; }
.cw-new:hover { background: rgba(var(--ov), .06); }
.cw-list a { display: flex; align-items: center; gap: 8px; }
.cw-list a span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-list a.on { background: rgba(var(--ov), .08); }
.cw-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.cw-none { padding: 8px 12px; font-size: 13px; }
.cw-note { font-size: 12px; padding: 8px 12px; display: flex; gap: 6px; line-height: 1.5; }
@media (max-width: 900px) {
  .cw { grid-template-columns: minmax(0, 1fr); }
  .cw-paneb { display: inline-grid; }
  .cw-side { position: fixed; z-index: 40; inset: auto 0 0 0; max-height: 70dvh; border-top: 1px solid var(--hair); border-radius: 18px 18px 0 0; background: rgb(var(--bg1)); transform: translateY(105%); transition: transform .25s; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
  .cw-side.open { transform: none; }
  .cw.cw-empty .cw-paneb { display: none; }
}
@media (max-width: 760px) { .cw-bar .menu-btn { display: block; width: 40px; height: 40px; } .cw-msgs { padding: 14px 12px; } .cw-box { margin: 0 10px; } }
.chat .cw-bar .cw-paneb { display: none; }
@media (max-width: 900px) { .chat .cw-bar .cw-paneb { display: inline-grid; } .chat .cw.cw-empty .cw-bar .cw-paneb { display: none; } }
.cw-list a { padding: 8px 12px; border-radius: 10px; color: inherit; text-decoration: none; font-size: 14px; }
.cw-list a:hover { background: rgba(var(--ov), .05); }
.cw-msgs .msg.user .b { max-width: 100%; }
.cw-box textarea { min-height: 44px; }
.cw-ask.done { border-color: var(--hair); opacity: .8; }
.cw-ask form { display: flex; gap: 6px; } .cw-ask form input { flex: 1; min-width: 0; }
.vid-list { display: grid; gap: 14px; margin-top: 6px; }
.vid-item { display: grid; gap: 6px; }
.vid-item video { width: 100%; border-radius: 12px; background: #000; max-height: 60vh; }
.vid-item video.tall { max-width: 320px; justify-self: center; }
.vid-wait { display: flex; align-items: center; gap: 8px; justify-content: center; min-height: 120px; border: 1px dashed rgba(var(--ov), .2); border-radius: 12px; color: var(--ash); font-size: 13.5px; padding: 12px; text-align: center; }
.vid-wait.failed { color: var(--red); }
.vid-card { margin: 10px 0; display: grid; gap: 6px; max-width: 640px; }
.vid-card video, .cw-shot video { width: 100%; border-radius: 12px; background: #000; max-height: 70vh; }
.vid-card video.tall { max-width: 320px; }
.pm-cmp { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 4px; padding: 7px 10px; border-radius: 10px; background: rgba(47,158,91,.12); color: #2f9e5b; font-size: 13px; font-weight: 600; line-height: 1.45; }
.pm-cmp .ic { flex: none; margin-top: 2px; }
.cmp-note { text-align: center; font-size: 12px; margin: 10px auto 0; max-width: 720px; line-height: 1.5; }
.cmp-band { padding: 32px 0 0; text-align: center; } .cmp-band h2 { font: 600 22px var(--display); margin: 0 0 12px; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; text-align: left; }
.cmp-card { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--hair); border-radius: 14px; color: inherit; text-decoration: none; font-size: 13.5px; }
.cmp-card b { font-size: 15px; } .cmp-card span:last-child { color: #2f9e5b; font-weight: 600; }
.cstep { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; font-weight: 600; }
.cstep b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 13px; flex: none; }
.cwarn { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: rgba(75, 79, 224,.12); font-size: 13.5px; }

/* ============================== UI 2.0 · Prism ==============================
   พื้นเย็น สะอาด ตัวหนังสือหมึก ปุ่มหลักสีหมึก · สีเดียวที่ "เคลื่อน" คือแสงสเปกตรัม (--spectrum) ใช้กับโควตา/ความคืบหน้าเท่านั้น
   indigo (--accent) = เลือกอยู่/ลิงก์/โฟกัส · สีสถานะใช้เมื่อมีความหมายเท่านั้น */
html, body { font-family: var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
:root { caret-color: var(--accent); accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--porcelain) 22%, transparent) transparent; }
a { text-underline-offset: .2em; }
/* ปุ่มหลัก: หมึก (ไม่ใช่สีส้ม) · ปุ่มรอง: ขอบบาง */
.btn.blue, :root[data-theme="light"] .btn.blue { background: var(--ink-btn); color: var(--ink-btn-fg); box-shadow: none; border-color: transparent; }
.btn.blue:hover, :root[data-theme="light"] .btn.blue:hover { background: color-mix(in srgb, var(--ink-btn) 86%, var(--accent)); }
.btn.out { box-shadow: 0 0 0 1px var(--steel) inset; color: var(--porcelain); }
.btn.out:hover { background: var(--accent-tint); }
/* แสงหักผ่านปริซึม: แถบโควตาและวงแหวนในหัวแชต */
.meter .fill { background: var(--spectrum); background-size: 100vw 100%; }
.meter.hi .fill { background: linear-gradient(90deg, #4b4fe0, #d9409a 60%, #e8590c); }
.meter.full .fill { background: var(--red); }
.ring { background: conic-gradient(from -90deg, #14b8d9, #4b4fe0 calc(var(--p) * .55%), #d9409a calc(var(--p) * 1%), var(--steel) 0); }
.ring.hi { background: conic-gradient(from -90deg, #4b4fe0, #d9409a calc(var(--p) * .6%), #e8590c calc(var(--p) * 1%), var(--steel) 0); }
.ring.full { background: conic-gradient(var(--red) calc(var(--p) * 1%), var(--steel) 0); }
/* หัวข้อ: ใช้ฟอนต์เดียวกัน น้ำหนักหนา ไม่ใช้ serif */
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.01em; }
/* ---------- แชต ---------- */
.chat .bar { background: var(--carbon); border-bottom: 1px solid var(--steel); min-height: 56px; }
.ctitle b { font-weight: 600; font-size: 16px; }
.lim { gap: 8px; color: var(--porcelain); font-weight: 600; font-variant-numeric: tabular-nums; border-color: var(--steel); background: var(--carbon); }
.lmini { display: inline-block; position: relative; width: 34px; height: 6px; border-radius: 9px; background: var(--steel); overflow: hidden; }
.lmini b { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 1%); border-radius: 9px; background: var(--spectrum); background-size: 34px 100%; }
.lmini.hi b { background: linear-gradient(90deg, #4b4fe0, #d9409a 60%, #e8590c); background-size: 34px 100%; }
.lmini.full b { background: var(--red); }
.msg { line-height: 1.75; }
.msg .b { font-size: var(--msgfs, 16.5px); }
.msg.user .b { background: var(--ink-btn); color: var(--ink-btn-fg); border-radius: 20px 20px 6px 20px; line-height: 1.6; }
.msg.user .b a { color: inherit; }
.msg .b .h { font-family: var(--display); }
.acts { gap: 4px; margin-top: 8px; }
.acts .tok { font-size: 12.5px; color: var(--ash); font-variant-numeric: tabular-nums; }
.compose .cbox { background: var(--carbon); -webkit-backdrop-filter: none; backdrop-filter: none; border: 1px solid var(--steel); border-radius: 22px; box-shadow: var(--shadow-1); }
.compose .cbox:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--steel)); box-shadow: var(--shadow-1), 0 0 0 4px var(--accent-tint); }
.cb { white-space: nowrap; background: var(--carbon); border-color: var(--steel); }
.cb.pick { font-weight: 600; }
.cb:hover { background: var(--accent-tint); }
.compose .send { background: var(--ink-btn); color: var(--ink-btn-fg); }
/* แถบข้าง: ปุ่มโหมด 3 ปุ่มต้องอยู่ในกรอบเสมอ (เดิม "Kyber Harness" ล้นออกนอกแถบ) */
.side .mode-seg button { min-width: 0; padding: 0 8px; font-size: 13.5px; }
.side .mode-seg button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-seg { background: var(--graphite); border-color: var(--steel); }
.mode-seg .on { background: var(--carbon); color: var(--porcelain); box-shadow: 0 1px 2px rgba(14, 17, 22, .08), 0 2px 8px rgba(14, 17, 22, .06); }
.mode-seg .on, .mode-seg .on:hover, .mode-seg .on:focus, .mode-seg .on span, .mode-seg .on .ic { color: var(--porcelain); } /* ปุ่มที่เลือก: การ์ดขาว ตัวหนังสือหมึก */
.mode-seg button span, .mode-seg a span { display: inline; min-height: 0; padding: 0; } /* ข้อความในปุ่มไม่ใช่ปุ่มซ้อน (กฎเดิมใส่ padding ให้ span ด้วยจนล้น) */
.side .mode-seg { gap: 2px; } .side .mode-seg button { gap: 5px; padding: 0 6px; } .side .mode-seg .ic { display: none; } /* แถบข้างแคบ: เหลือชื่อโหมดอย่างเดียวให้อ่านครบ */
.side { background: var(--graphite); }
/* ช่องพิมพ์บนมือถือ: ระดับการคิดเหลือแค่ไอคอน ให้ชื่อโมเดลอ่านได้เต็ม */
@media (max-width: 420px) { #eff { padding: 0 9px; font-size: 0; gap: 2px; } #eff svg { width: 16px; height: 16px; } .cb.pick#mdl { max-width: 48vw; } }
/* ---------- หน้าแรก ---------- */
[data-page=home]::before { background: none; }
[data-page=home] { background: var(--obsidian); }
[data-page=home] .hero { padding: 56px 16px 24px; }
[data-page=home] .hero::before { background: none; }
/* แสงหักผ่านผลึกพาดหลังหัวข้อ: แถบสเปกตรัมบาง เบลอนุ่ม (ไม่ใช่ก้อนสีลอย) */
[data-page=home] .hero::after { content: ''; position: absolute; z-index: 0; left: -10%; right: -10%; top: 210px; height: 120px; background: var(--spectrum); opacity: .13; filter: blur(48px); transform: rotate(-4deg); pointer-events: none; }
/* ชื่อแบรนด์: โลโก้ + Kyber (ไม่ใช่ป้ายตัวเล็กเหนือหัวข้อ) */
[data-page=home] .hero .name { display: inline-flex; align-items: center; gap: 10px; font: 700 22px/1 var(--font); letter-spacing: -0.01em; text-transform: none; color: var(--porcelain); }
[data-page=home] .hero .name::before { content: ''; width: 34px; height: 34px; border-radius: 9px; background: url(/icon.svg) center / cover; }
[data-page=home] .hero .name + p { margin: 8px auto 0; font-size: 14px; color: var(--ash); }
[data-page=home] .hero h1 { font-weight: 700; letter-spacing: -0.02em; margin: 22px 0 18px; color: var(--porcelain); }
[data-page=home] .hero p { color: var(--ash); font-size: 17.5px; line-height: 1.65; }
[data-page=home] .hero p b { color: var(--porcelain); }
[data-page=home] .showcase, .showcase { background: var(--carbon); -webkit-backdrop-filter: none; backdrop-filter: none; border: 1px solid var(--steel); box-shadow: 0 2px 4px rgba(14, 17, 22, .04), 0 24px 60px rgba(30, 36, 80, .12); }
.sc-pill { background: var(--graphite); border-color: var(--steel); color: var(--porcelain); }
.sc-u { background: var(--ink-btn) !important; color: var(--ink-btn-fg) !important; }
[data-page=home] .tile, .tile { background-color: var(--carbon); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--steel); box-shadow: var(--shadow-1); }
.card { background-color: var(--carbon); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--shadow-1); }

/* Prism: band เป็นการ์ดขาวแทนพื้นดำเดิม */
.band { background: var(--carbon); border: 1px solid var(--steel); box-shadow: var(--shadow-1); }
.band h2 { color: var(--porcelain); }
.cmp td:first-child, .cmp th:first-child { background: var(--carbon); }
.hero::before { background: none; }
.sc-pill, .sc-bar .lim { white-space: nowrap; }
.sc-bar .lim { box-shadow: none; border: 1px solid var(--steel); background: var(--carbon); }
@media (max-width: 520px) { .sc-dots { display: none; } .sc-bar { gap: 6px; } .sc-bar .sc-pill:nth-child(3) { display: none; } [data-page=home] .hero h1 { font-size: clamp(30px, 8.6vw, 40px); } }
/* Prism: หน้าแพลน/บัญชี */
@media (min-width: 768px) { .hero h1 { font-size: 56px; letter-spacing: -0.02em; } }
.hero h1 { font-weight: 700; }
.bar1 > div { background: var(--spectrum); background-size: 100vw 100%; }
.acc-meter.hi .bar1 > div { background: linear-gradient(90deg, #4b4fe0, #d9409a 60%, #e8590c); }
.acc-meter.full .bar1 > div { background: var(--red); }
.ls-bar i { background: var(--spectrum); background-size: 100vw 100%; }
.sw span { background: #c9cede; }
.sw span::before { box-shadow: 0 1px 3px rgba(14, 17, 22, .25); }
.sw input:checked + span { background: var(--blue); }
[data-theme=dark] .sw span { background: #3a4152; }
/* UI 2.0 · แพลนแบบรายการแนวตั้ง */
.pl-promo { display: flex; gap: 8px; align-items: flex-start; max-width: 720px; margin: 0 auto 14px; padding: 11px 14px; border-radius: 14px; background: var(--accent-tint, rgba(75,79,224,.08)); color: var(--porcelain); font-size: 14px; line-height: 1.5; }
.pl-promo .ic { color: var(--blue); flex: none; margin-top: 3px; }
.pl { display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin: 0 auto; text-align: left; }
.pl .tile.plan { padding: 16px 18px; border-radius: 18px; background: var(--carbon); border: 1px solid var(--steel); box-shadow: none; transform: none; }
.pl .tile.plan:active { transform: none; }
.pl .tile.plan:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.pl .tile.plan.feat { border: 2px solid var(--porcelain); padding: 15px 17px; box-shadow: var(--shadow-1); }
.pl .tile.plan.sel { border: 2px solid var(--blue); padding: 15px 17px; box-shadow: 0 0 0 4px rgba(75, 79, 224, .12); }
.pl-h { display: flex; align-items: center; gap: 10px; }
.pl-n { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pl-n b { font: 600 18px/1.3 var(--display); color: var(--porcelain); }
.pl-n small { color: var(--ash); font-size: 12.5px; }
.pl-badge { font: 600 11.5px var(--font); color: var(--ink-btn-fg, #fff); background: var(--ink-btn, #0e1116); padding: 2px 9px; border-radius: 9999px; }
.pl-p { font: 700 22px/1.2 var(--display); color: var(--porcelain); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-p small { font: 500 13px var(--font); color: var(--ash); margin-left: 2px; }
.pl-chev { color: var(--ash); transition: transform .2s; flex: none; }
.pl .open .pl-chev { transform: rotate(180deg); }
.pl-x { display: grid; gap: 6px; margin-top: 8px; font-size: 13.5px; color: var(--ash); }
.pl-x b { color: var(--porcelain); }
.pl-bar { display: block; height: 6px; border-radius: 9999px; background: var(--graphite); overflow: hidden; }
.pl-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--spectrum); background-size: 680px 100%; }
.pl-more { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--steel); }
.pl .open .pl-more { display: block; }
.pl-desc { margin: 0 0 10px; color: var(--ash); font-size: 14px; line-height: 1.6; }
.pl-li { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 14px; line-height: 1.55; color: var(--porcelain); }
.pl-li .ic { flex: none; margin-top: 3px; color: var(--blue); }
.pl-li.ok .ic, .pl-li.ok { color: var(--green); }
.pl .pm-head { margin: 14px 0 6px; font-size: 12.5px; color: var(--ash); opacity: 1; }
.pl-cta { width: 100%; margin-top: 16px; justify-content: center; }
.pl-foot { text-align: center; margin: 14px auto 0; max-width: 720px; font-size: 13px; }
/* กันหน้าเลื่อนแนวนอนบนมือถือ (ของที่ล้นต้องเลื่อนในกล่องตัวเอง) */
html, body { overflow-x: clip; max-width: 100%; }
/* UI 2.0 · หัวหน้า /plans */
.shop-hero { max-width: 720px; margin: 0 auto; padding: 28px 0 18px; text-align: left; }
.shop-hero h1 { font: 700 32px/1.25 var(--display); letter-spacing: -0.02em; margin: 0 0 12px; color: var(--porcelain); }
@media (min-width: 768px) { .shop-hero { padding-top: 44px; } .shop-hero h1 { font-size: 40px; } }
.shop-cur { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 12px 16px; border-radius: 14px; background: var(--carbon); border: 1px solid var(--steel); font-size: 14px; color: var(--ash); }
.shop-cur b { color: var(--porcelain); }
.shop-ctl { display: flex; gap: 8px; margin: 14px 0 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.shop-ctl::-webkit-scrollbar { display: none; }
.shop-ctl .seg { margin: 0 !important; flex: none; }
.shop-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; font-size: 13.5px; }
.shop-quote { text-align: center; margin: 24px 0 8px; }
.value-card { max-width: 720px; margin: 0 auto 14px; }
/* UI 2.0 · หน้าแรก: ทำอะไรได้บ้าง */
.fg { display: grid; grid-template-columns: 1fr; gap: 10px; max-width: 980px; margin: 0 auto; }
@media (min-width: 640px) { .fg { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .fg { grid-template-columns: repeat(3, 1fr); } }
.fi { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px; padding: 16px; border-radius: 18px; background: var(--carbon); border: 1px solid var(--steel); color: inherit; text-decoration: none; text-align: left; }
.fi > .ic { grid-row: 1 / 3; width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--graphite); color: var(--blue); box-sizing: border-box; }
.fi b { font: 600 16px/1.35 var(--display); color: var(--porcelain); }
.fi span { font-size: 14px; line-height: 1.55; color: var(--ash); }
a.fi:hover { border-color: var(--blue); }
a.fi b::after { content: ' →'; color: var(--blue); }
.pl-all { text-align: center; margin: -36px 0 48px; font-size: 14.5px; }
[data-page=home] .band h2 { font-weight: 700; letter-spacing: -0.02em; }
@media (max-width: 640px) { [data-page=home] .band h2 { font-size: 26px; margin-bottom: 18px; } [data-page=home] .band { margin-bottom: 36px; } }
/* UI 2.0 · หน้าบัญชี */
.acc-nav { background: var(--obsidian); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 1px solid var(--steel); }
.acc-nav a { background: var(--carbon); border-color: var(--steel); }
.acc-nav a.on { background: var(--ink-btn, #0e1116); border-color: transparent; color: var(--ink-btn-fg, #fff); }
.acc-big { background: var(--carbon); background-image: none; border-color: var(--steel); border-radius: 18px; }
.acc-c { border-radius: 18px; }
.shop-sub { margin: 0; color: var(--ash); font-size: 15px; line-height: 1.6; }
.shop-hero + .tok-help, .shop-hero ~ .pgrid { max-width: 980px; margin-left: auto; margin-right: auto; }
.shop-hero .tok-help { margin-top: 14px; }
@media (max-width: 640px) { .shop-ctl { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 28px; } }
/* หน้าราคา: ตัวเลขราคาต้องเข้มอ่านชัด */
.pc-v b { color: var(--porcelain); font-weight: 700; }
.pc-v b s { color: var(--ash); font-weight: 500; }
:root:not([data-theme=dark]) .pc-v .oc { color: #4a5060; }
:root:not([data-theme=dark]) .vc-r s { color: #4a5060; }
/* เมนู ☰ หน้าอื่น: หน้าตาเดียวกับแถบข้างหน้าแชต */
.nav-panel .mode-seg .ic { display: none; }
.nav-panel .mode-seg a { justify-content: center; font-size: 13.5px; }
.nav-panel .mode-seg a.on { background: var(--carbon); color: var(--porcelain); box-shadow: var(--shadow-1); }
.nav-panel .work-tiles .wtile { text-decoration: none; color: inherit; }
.nav-panel .side-nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 12px; color: var(--porcelain); text-decoration: none; font-size: 14.5px; }
.nav-panel .side-nav a .ic { color: var(--ash); }
@media (hover: hover) { .nav-panel .side-nav a:hover { background: var(--graphite); } }
/* Canvas · พรีวิวตามขนาดอุปกรณ์ */
.cv-dev { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--steel); background: var(--carbon); overflow-x: auto; scrollbar-width: none; }
.cv-dev::-webkit-scrollbar { display: none; }
.cv-dev .seg { margin: 0; flex: none; }
.cv-dev .seg button { display: inline-flex; align-items: center; gap: 6px; }
.cv-dev select { width: auto; min-height: 32px; padding: 0 28px 0 10px; font-size: 12.5px; border-radius: 9999px; flex: none; }
.cv-dev small { flex: none; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .cv-dev .seg button span { display: none; } }
.canvas.is-file .cv-dev { display: none; }
.cv-stage { flex: 1; min-height: 0; display: flex; }
.cv-stage[hidden] { display: none; }
.cv-frame { flex: 1; display: flex; min-width: 0; }
.cv-frame iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.cv-stage:not([data-dev=full]) { align-items: center; justify-content: center; overflow: hidden; background: var(--graphite); background-image: radial-gradient(rgba(var(--ov), .07) 1px, transparent 1px); background-size: 18px 18px; }
.cv-stage:not([data-dev=full]) .cv-frame { flex: none; position: relative; display: block; overflow: hidden; background: #fff; }
.cv-stage:not([data-dev=full]) .cv-frame iframe { position: absolute; top: 0; left: 0; flex: none; }
.cv-stage[data-dev=phone] .cv-frame { border-radius: 34px; box-shadow: 0 0 0 9px #0e1116, 0 0 0 10px #3a4152, 0 24px 60px rgba(14, 17, 22, .35); }
.cv-stage[data-dev=phone] .cv-frame::before { content: ''; position: absolute; z-index: 1; top: 8px; left: 50%; transform: translateX(-50%); width: 30%; max-width: 110px; height: 22px; border-radius: 9999px; background: #0e1116; pointer-events: none; }
.cv-stage[data-dev=tablet] .cv-frame { border-radius: 22px; box-shadow: 0 0 0 12px #0e1116, 0 0 0 13px #3a4152, 0 24px 60px rgba(14, 17, 22, .3); }
.cv-stage[data-dev=desktop] .cv-frame { border-radius: 10px; box-shadow: 0 0 0 1px var(--steel), 0 18px 50px rgba(14, 17, 22, .22); border-top: 26px solid #e3e6ee; }
.cv-stage[data-dev=desktop] .cv-frame { box-sizing: content-box; }
/* Canvas หัวแถบ: ธีมสว่างตาม UI 2.0 (เดิมพื้นดำ ตัวหนังสือมองไม่เห็น) */
.cv-h { background: var(--carbon); color: var(--porcelain); border-bottom: 1px solid var(--steel); -webkit-backdrop-filter: none; backdrop-filter: none; }
.cv-h select { color: inherit; background: var(--carbon); }
.cv-h .icon-btn { color: var(--porcelain); }
.canvas { background: var(--carbon); }
@media (max-width: 600px) {
  .cv-h { flex-wrap: wrap; row-gap: 6px; }
  .cv-h b#cv-t { flex: 1 1 calc(100% - 60px); max-width: none; order: 0; }
  .cv-h #cv-x { order: 1; }
  .cv-h > .seg, .cv-h > select { order: 2; }
  .cv-h > .sp { order: 2; }
  .cv-h > .btn, .cv-h > #cv-dl { order: 3; }
}
@media (max-width: 600px) { .cv-h > .sp { display: none; } }
.cw-cost { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: var(--graphite); font-size: 13px; color: var(--ash); }
.cw-cost b { color: var(--porcelain); }
.ag-used { color: var(--porcelain); }
