/* UGC Agent Service — สไตล์เดียวใช้ทั้งเว็บบัญชี (8810/VPS) และหน้าเข้าสู่ระบบในแอป (/studio/local.css)
   โทนมืดเรียบ ๆ: พื้นดำ แสงจางด้านบน การ์ดขอบบาง ปุ่มหลักไล่สีน้ำเงิน
   เว็บบัญชีมี CSP ห้าม style ในหน้า — ใช้คลาสในไฟล์นี้เท่านั้น */
:root{
  --font:"Segoe UI","Noto Sans Thai",Tahoma,system-ui,sans-serif;
  --mono:"Cascadia Mono",Consolas,ui-monospace,monospace;
  --bg:#0b0d12;--surface:#12151c;--surface-2:#161a22;--hover:#1d222c;
  --border:#222733;--border-strong:#2d3340;
  --text:#e8ebf2;--text-2:#a3abba;--muted:#6f7889;
  --link:#8b92ff;--accent-a:#3d3fb8;--accent-b:#3a6fa6;--focus:#5b63e6;
  --lime:#d9f879;--lime-ink:#22301f;
  --ok:#7bd69a;--ok-soft:#14261b;--warn:#ffb27f;--warn-soft:#2a1c14;--danger:#ff8f84;--danger-soft:#2b1717;
  --radius:12px;
  color-scheme:dark;
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;min-height:100vh;font:14px/1.6 var(--font);color:var(--text);background:var(--bg);position:relative;overflow-x:hidden}
/* แสงจางด้านบนกลางจอ */
body::before{content:"";position:fixed;inset:-30vh -10vw auto;height:80vh;pointer-events:none;z-index:0;
  background:radial-gradient(ellipse 45% 55% at 52% 0%,#1d2a4a66,transparent 70%),radial-gradient(ellipse 18% 40% at 60% 0%,#2a3d6a33,transparent 70%)}
body > *{position:relative;z-index:1}
[hidden]{display:none!important}
a{color:var(--link);text-decoration:none}
a:hover{text-decoration:underline}
h1{font-size:28px;line-height:1.25;margin:0 0 6px;font-weight:700;letter-spacing:-.01em}
h2{font-size:16px;margin:0 0 4px}
h3{font-size:13px;margin:0 0 8px;color:var(--text-2);font-weight:600}
small,.muted{color:var(--muted)}
code,.mono{font-family:var(--mono)}

/* ---------- หน้าเข้าสู่ระบบ / สมัคร (กลางจอ แคบ) ---------- */
.auth{width:100%;max-width:372px;margin:0 auto;padding:12vh 20px 40px;text-align:center}
.auth.wide{max-width:520px}
.logo{display:inline-grid;place-items:center;width:52px;height:52px;border-radius:14px;margin-bottom:22px;
  background:linear-gradient(160deg,#20242e,#14171e);border:1px solid var(--border-strong);box-shadow:0 10px 30px #00000066;
  color:var(--lime);font-weight:800;font-size:22px}
.sub{color:var(--muted);margin:0 0 30px}
.auth form,.auth .stack{text-align:left}
.field{display:block;margin:0 0 14px;color:var(--muted);font-size:12.5px}
.field input,.field select,.input{display:block;width:100%;margin-top:6px;height:42px;padding:0 13px;border-radius:9px;
  border:1px solid var(--border);background:var(--surface-2);color:var(--text);font:inherit;font-size:14px}
.field input:focus,.field select:focus,.input:focus{outline:none;border-color:var(--focus);box-shadow:0 0 0 3px #5b63e633}
/* ช่องวางหลายบรรทัด (ลิงก์สินค้าในการ์ดสั่งงาน) */
textarea.input{height:auto;min-height:96px;padding:10px 13px;resize:vertical;line-height:1.5}
.field input::placeholder{color:#59616f}
.foot{margin-top:34px;color:var(--muted);font-size:12px}
.divider{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:12px;margin:18px 0}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--border)}

/* ---------- ปุ่ม ---------- */
button,.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border-radius:9px;
  font:inherit;font-weight:600;font-size:13.5px;cursor:pointer;border:1px solid transparent;text-decoration:none;white-space:nowrap}
button:disabled{opacity:.55;cursor:progress}
.primary{width:100%;height:42px;color:#fff;background:linear-gradient(90deg,var(--accent-a),var(--accent-b));box-shadow:0 8px 24px #3a4fb033}
.primary:hover:not(:disabled){filter:brightness(1.12)}
.primary.fit{width:auto}
.secondary{background:var(--surface-2);color:var(--text);border-color:var(--border)}
.secondary:hover:not(:disabled){background:var(--hover);text-decoration:none}
.text{background:none;border:0;color:var(--muted);height:auto;padding:4px 6px;font-weight:500}
.text:hover{color:var(--text)}
.small{height:30px;padding:0 11px;font-size:12.5px;border-radius:7px}
.danger{color:var(--danger)}
.row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.row.end{justify-content:flex-end}
.grow{flex:1}
.mt{margin-top:16px}

/* ---------- แจ้งเตือน ---------- */
.alert{margin:0 0 16px;padding:10px 13px;border-radius:9px;background:var(--warn-soft);border:1px solid #5a3a26;color:var(--warn);
  font-size:13px;white-space:pre-wrap;text-align:left}
.alert.ok{background:var(--ok-soft);border-color:#24442f;color:var(--ok)}
.toast{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);z-index:50;max-width:min(560px,calc(100vw - 32px));box-shadow:0 12px 30px #0009}

/* ---------- การ์ด ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;margin:0 0 14px;text-align:left}
.card > p:last-child{margin-bottom:0}
.step{display:flex;gap:14px}
.step-no{flex:none;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--surface-2);
  border:1px solid var(--border-strong);color:var(--text-2);font-size:12px;font-weight:700}
.step > div{flex:1;min-width:0}
.step p{margin:2px 0 12px;color:var(--text-2)}

/* โค้ดคำขอ / คีย์ ตัวใหญ่ + ปุ่มคัดลอก */
.code-box{display:flex;align-items:center;gap:10px;padding:12px 12px 12px 16px;border-radius:10px;background:var(--bg);border:1px dashed var(--border-strong)}
.code-box strong{flex:1;font-family:var(--mono);font-size:22px;letter-spacing:.12em;color:var(--text);overflow-wrap:anywhere}
.code-box.key strong{font-size:18px;color:var(--lime)}
.key-input{font-family:var(--mono)!important;letter-spacing:.08em;text-transform:uppercase}

.choice{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border:1px solid var(--border);border-radius:9px;margin-top:8px;cursor:pointer;color:var(--text-2)}
.choice:has(input:checked){border-color:var(--focus);background:#5b63e612;color:var(--text)}
.choice input{margin-top:4px;accent-color:var(--focus)}
.choice small{display:block}
details > summary{cursor:pointer;color:var(--muted);font-size:12.5px;margin-top:14px;list-style-position:inside}
details[open] > summary{margin-bottom:6px}

.spinner{width:30px;height:30px;margin:6px auto 18px;border-radius:50%;border:3px solid var(--border-strong);border-top-color:var(--link);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- หน้าบัญชีในแอป ---------- */
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px;margin:0 0 14px}
.tile{display:block;padding:16px;border-radius:var(--radius);background:var(--surface);border:1px solid var(--border);color:var(--text);text-align:left;transition:border-color .15s,transform .15s}
.tile:hover{border-color:var(--focus);transform:translateY(-1px);text-decoration:none}
.tile strong{display:block;font-size:15px}
.tile span{color:var(--muted);font-size:12.5px}
.tile.main{background:linear-gradient(135deg,#1c2150,#17304a);border-color:#2e3a6a}
.list{list-style:none;margin:0;padding:0}
.list li{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:9px 0;border-top:1px solid var(--border)}
.list li:first-child{border-top:0}
.list .empty{color:var(--muted)}
.pill{display:inline-block;font-size:11.5px;padding:1px 9px;border-radius:99px;background:var(--surface-2);border:1px solid var(--border);color:var(--text-2);white-space:nowrap}
.pill.ok{color:var(--ok);border-color:#24442f;background:var(--ok-soft)}
.pill.wait{color:var(--warn);border-color:#5a3a26;background:var(--warn-soft)}
.pill.admin{color:#b9bcff;border-color:#34397a;background:#1b1d40}

/* ---------- เว็บบัญชี: แถบบน + ตาราง ---------- */
.topbar{display:flex;align-items:center;gap:14px;padding:14px 24px;border-bottom:1px solid var(--border);background:#0b0d12cc;backdrop-filter:blur(8px);position:sticky;top:0;z-index:20}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:.04em}
.brand .logo{width:30px;height:30px;border-radius:8px;font-size:14px;margin:0;box-shadow:none}
.page{max-width:1160px;margin:0 auto;padding:28px 24px 60px}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin:30px 0 12px}
.section-head:first-child{margin-top:0}
.section-head p{margin:2px 0 0;color:var(--muted)}
.table-wrap{overflow-x:auto;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius)}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th{text-align:left;font-weight:600;font-size:12px;color:var(--muted);padding:10px 12px;border-bottom:1px solid var(--border);white-space:nowrap;background:var(--surface-2)}
td{padding:9px 12px;border-bottom:1px solid var(--border);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover td{background:#ffffff04}
tr.dirty td{background:#5b63e60d}
tr.inactive td.user{opacity:.5}
td.user strong{display:block}
td.center,th.center{text-align:center}
td select,td input[type=number]{height:32px;border-radius:7px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font:inherit;font-size:13px;padding:0 8px}
td input[type=number]{width:62px}
td input[type=checkbox]{width:16px;height:16px;accent-color:var(--focus);cursor:pointer}
.quota{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;color:var(--muted)}
.quota.full{color:var(--warn)}
tr.detail td{background:var(--bg);padding:14px 16px}
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.lookup{display:flex;gap:8px;max-width:420px}
.lookup .input{margin:0;height:40px}
.issue{border-color:#34397a;background:linear-gradient(180deg,#151933,var(--surface))}
.issue .checks{display:flex;gap:18px;margin:12px 0}
.issue label{display:inline-flex;align-items:center;gap:7px;cursor:pointer}
.empty-row td{color:var(--muted);text-align:center;padding:22px}

/* ---------- จอเล็ก ---------- */
@media (max-width:720px){
  .auth{padding-top:8vh}
  .topbar{padding:12px 16px}
  .page{padding:20px 16px 48px}
  .detail-grid{grid-template-columns:1fr}
  .section-head{flex-direction:column;align-items:stretch}
  .lookup{max-width:none}
}

/* ฟอร์มแบบแถว (เพิ่มบัญชี / เปลี่ยนรหัส / ตั้งรหัสใหม่) */
form.row{align-items:flex-end}
form.row .field{margin:0;min-width:180px}
td.user small{display:block;color:var(--muted);font-size:12px}
.save:disabled{background:var(--surface-2);color:var(--muted);box-shadow:none;border-color:var(--border);cursor:default}
details.card > summary{margin-top:0}

/* ภาพรวมงานของคอม (งาน / โพสต์ / ตั้งค่า) */
details.sub{border-top:1px solid var(--border);margin-top:14px;padding-top:10px}
details.sub > summary{cursor:pointer;font-weight:600;padding:4px 0}
.small{font-size:12px}
.pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin-top:8px}
.pcard{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;overflow:hidden;display:flex;flex-direction:column}
.pcard img,.pcard .noimg{width:100%;aspect-ratio:9/12;object-fit:cover;background:var(--bg);display:block}
.pcard .noimg{display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px}
.pcard > div{padding:8px 9px;display:flex;flex-direction:column;gap:5px;min-width:0}
.pcard strong{font-size:12.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pcard small{color:var(--muted);font-size:11.5px;line-height:1.35;overflow-wrap:anywhere}
.pcard .pill{align-self:flex-start}
.pcard .pactions{display:flex;flex-wrap:wrap;gap:5px;margin-top:2px}
.pcard .pactions button{padding:4px 9px;font-size:11.5px}
.pill.bad{color:#ff9b9b;border-color:#5a2626;background:#2a1414}
.settings-form .row{margin-top:6px}
.settings-form .field{min-width:180px}
label.check{display:inline-flex;align-items:center;gap:7px;cursor:pointer;color:var(--text-2);font-size:13px;margin-right:12px}
label.check input{width:16px;height:16px;accent-color:var(--focus)}
@media (max-width:720px){ .pgrid{grid-template-columns:repeat(2,1fr)} .settings-form .field{min-width:0;width:100%} }
.note{font-size:12px;line-height:1.55}
ol.note{padding-left:20px}
.sha{overflow-wrap:anywhere}

/* ---------- เว็บ host เป็นทางเข้าเดียว (2026-10-29): เลือกบริการ / มอนิเตอร์ / หน้าบริการเบลอรอสมอง ---------- */
a.brand{color:var(--text)}
a.brand:hover{text-decoration:none}
.topbar .button.text{height:30px}
.tiles.services{grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.tile.service{padding:20px;min-height:128px;display:flex;flex-direction:column;gap:4px}
.tile.service strong{font-size:17px}
.tile.service em{font-style:normal;margin-top:auto;padding-top:10px}
.bad-text{color:var(--danger)}
.mon{align-items:flex-start!important}
.mon .pill{margin-left:4px}
.mon form.links{max-width:560px}
/* หน้าบริการที่ยังไม่มีสมอง: โครงหน้าทำงานจาง ๆ ด้านหลัง กดอะไรไม่ได้ + กล่องบังคับตรงกลาง */
.gate-wrap{position:relative;min-height:560px}
.ghost{position:absolute;inset:0;display:flex;gap:16px;filter:blur(6px);opacity:.45;pointer-events:none;user-select:none}
.ghost i,.ghost b{display:block;background:var(--surface-2);border:1px solid var(--border);border-radius:10px}
.ghost-side{width:200px;display:flex;flex-direction:column;gap:10px}
.ghost-side i{height:44px}
.ghost-main{flex:1;display:flex;flex-direction:column;gap:14px}
.ghost-main b{height:90px}
.ghost-row{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.ghost-row i{height:70px}
.ghost-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.ghost-grid i{height:150px}
.gate{position:relative;max-width:520px;margin:40px auto 0;box-shadow:0 20px 60px #000a;border-color:var(--border-strong)}
.gate h2{font-size:20px}
.gate details.sub{margin-top:18px}
.waiting{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:12.5px}
.dot{width:8px;height:8px;border-radius:50%;background:var(--warn);animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{50%{opacity:.25}}
@media (max-width:720px){
  .ghost-side{display:none}
  .ghost-row,.ghost-grid{grid-template-columns:repeat(2,1fr)}
  .gate{margin-top:16px}
  #who{display:none}
}

/* ---------- การ์ดเปิด UGC Studio (/app/) ---------- */
.lhero{display:flex;align-items:center;gap:16px;background:linear-gradient(135deg,#1c2150,#17304a);border-color:#2e3a6a}
.lhero h2{font-size:20px}
@media (max-width:720px){ .lhero{flex-direction:column;align-items:stretch} }
