/* TUNGKAO — แนวพิมพ์ธนบัตร/เช็คธนาคาร: หมึกน้ำเงินเข้ม + เขียวแถบความปลอดภัย + ทองฟอยล์ (ใช้น้อย)
   จุดเด่นเดียว: ลายกิโยเช (guilloche) บนหน้าเข้าสู่ระบบและการ์ดยอดเงิน ที่เหลือเรียบ */
@font-face { font-family: "Plex Thai"; font-weight: 400; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-thai-400-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 500; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-thai-500-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 600; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-thai-600-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 700; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-thai-700-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 400; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Thai"; font-weight: 500; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Thai"; font-weight: 600; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Thai"; font-weight: 700; font-display: swap; src: url(/static/fonts/ibm-plex-sans-thai-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* กระดาษธนบัตร (เทาอมเขียวเย็น) — ไม่ใช่ครีม */
  --bg: #ECF1EE; --panel: #FFFFFF; --panel-2: #F5F8F6; --line: #D3DDD7; --line-2: #BFCCC4;
  --text: #0F1E33; --muted: #566577; --ink: #0E1A2B; --ink-2: #16273E;
  --primary: #0B7A63; --primary-hover: #096A56; --primary-text: #FFFFFF; --mint: #1FB58F; --gold: #B8912A; --gold-2: #E2C468;
  --ok: #0B7A4E; --warn: #9A5B07; --bad: #B42318; --ok-bg: #E2F4EC; --warn-bg: #FBF0DA; --bad-bg: #FCE5E2;
  --shadow: 0 1px 0 rgba(14, 26, 43, .04), 0 6px 18px -10px rgba(14, 26, 43, .18);
  --radius: 12px; --radius-sm: 8px;
  --font: "Plex Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #08111E; --panel: #0F1C2E; --panel-2: #0C1726; --line: #1E3048; --line-2: #2A4060;
  --text: #E6EDF3; --muted: #92A3B8; --ink: #060D18; --ink-2: #0C1828;
  --primary: #22B892; --primary-hover: #2CCBA2; --primary-text: #04221A; --mint: #2CCBA2; --gold: #D4AF4A; --gold-2: #E9CF7A;
  --ok: #43D29E; --warn: #F0B54A; --bad: #F2867A; --ok-bg: #0B2A22; --warn-bg: #2B2110; --bad-bg: #2E1414;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- หัวเว็บ: หมึกเข้ม + แถบความปลอดภัยเขียว/ทองบาง ๆ ใต้หัว ---------- */
.topbar { background: var(--ink); color: #E6EDF3; display: flex; align-items: center; gap: 10px; padding: 10px 18px; position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
  border-bottom: 3px solid transparent; border-image: linear-gradient(90deg, var(--mint) 0 70%, var(--gold-2) 70% 100%) 1; }
.brand { font-weight: 700; letter-spacing: .14em; font-size: 17px; display: flex; align-items: center; gap: 10px; color: #fff; }
.brand .mark { width: 30px; height: 30px; flex: none; font-size: 0; background: url(/static/icon.svg) center / contain no-repeat; }
.brand small { font-weight: 500; letter-spacing: 0; color: #9FB0C4; font-size: 13px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .16); }
.topbar .spacer { flex: 1; }
.topbar .who { color: #9FB0C4; font-size: 13px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar select, .topbar button { background: transparent; color: #E6EDF3; border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--radius-sm); padding: 6px 10px; font: inherit; font-size: 13px; width: auto; }
.topbar button:hover, .topbar select:hover { border-color: rgba(255, 255, 255, .45); }
.topbar option { color: #000; }
.topbar select { max-width: 46vw; }
/* ปุ่มสลับธีม: ไอคอนพระจันทร์/ดวงอาทิตย์ (ไม่พึ่งตัวอักษรในฟอนต์) */
.topbar button[aria-label="Theme"] { width: 36px; height: 34px; padding: 0; font-size: 0; background: center / 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E6EDF3' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .topbar button[aria-label="Theme"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E2C468' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M2.5 12h2.2M19.3 12h2.2M5.3 5.3l1.6 1.6M17.1 17.1l1.6 1.6M5.3 18.7l1.6-1.6M17.1 6.9l1.6-1.6'/%3E%3C/svg%3E"); }

/* ---------- เมนู: แท็บเส้นใต้ ---------- */
.nav { display: flex; gap: 2px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); padding: 13px 12px 11px; font-weight: 500; font-size: 14.5px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); font-weight: 600; border-bottom-color: var(--mint); }

main { max-width: 1120px; margin: 0 auto; padding: 26px 18px 64px; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }

/* ---------- การ์ด ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.stat .label { color: var(--muted); font-size: 13.5px; }
.stat .value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin: 2px 0; }
.stat .sub { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* การ์ดยอดเงินหลัก = ธนบัตร: ลายกิโยเช + ขอบไมโครพริ้นต์ + เส้นทอง */
.hero { position: relative; overflow: hidden; color: #F2F6F8; border: 0; background: var(--ink-2); isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(226, 196, 104, .35), inset 0 0 0 5px var(--ink-2), inset 0 0 0 6px rgba(31, 181, 143, .35); }
.hero::before { content: ""; position: absolute; inset: -70% -30% -70% 30%; background: url(/static/guilloche.svg) center / contain no-repeat; opacity: .9; z-index: -1; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: repeating-linear-gradient(90deg, var(--gold-2) 0 6px, transparent 6px 9px); opacity: .5; }
.hero .label, .hero .sub { color: #A9BACB; }
.hero .value { font-size: 34px; color: #fff; }

/* ---------- ตาราง ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; background: var(--panel-2); }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover td { background: var(--panel-2); }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scroll table th:first-child, .scroll table td:first-child { padding-left: 14px; }
.card .scroll { border: 0; border-radius: 0; margin: 0 -18px; }
.card .scroll:last-child { margin-bottom: -18px; }
.card .scroll:last-child tr:last-child td { border-bottom: 0; }
.scroll table { min-width: 560px; }
td.mono, td .mono { white-space: nowrap; word-break: normal; }
td { white-space: nowrap; }
td:last-child { white-space: normal; }
.mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- ป้ายสถานะ ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

/* ---------- ปุ่ม/ฟอร์ม ---------- */
button, .btn { font: inherit; font-weight: 600; font-size: 14.5px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel); color: var(--text); padding: 9px 16px; cursor: pointer; transition: background-color .15s, border-color .15s; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger { color: var(--bad); border-color: currentColor; background: transparent; }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 22%, transparent); background: var(--panel); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
textarea { min-height: 96px; font-family: var(--mono); font-size: 13px; }
input[type="file"] { padding: 8px; color: var(--muted); border-style: dashed; cursor: pointer; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; font-size: 14px; margin-right: 12px; padding: 7px 14px; border-radius: 6px; border: 0; background: var(--ink-2); color: #fff; cursor: pointer; }
:root[data-theme="dark"] input[type="file"]::file-selector-button { background: var(--line-2); }
label { display: block; font-size: 13.5px; font-weight: 500; color: var(--muted); margin: 12px 0 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 170px; }
.row > button { flex: 0 0 auto; min-height: 44px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice { border-radius: var(--radius-sm); padding: 11px 14px; margin: 12px 0; font-size: 14px; border: 1px solid var(--line); background: var(--panel-2); }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.secret { background: var(--warn-bg); border: 1px dashed var(--warn); border-radius: var(--radius-sm); padding: 14px; margin: 12px 0; }

/* ---------- หน้าเข้าสู่ระบบ: แผ่นตราประทับลายกิโยเช + การ์ดเข้าสู่ระบบ ---------- */
.login { max-width: 960px; margin: 6vh auto 0; padding: 0 18px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; align-items: stretch; }
.login .seal { position: relative; overflow: hidden; isolation: isolate; background: var(--ink); color: #E6EDF3; border-radius: 18px 0 0 18px; padding: 40px 36px; display: flex; flex-direction: column; justify-content: flex-end; min-height: 440px;
  box-shadow: inset 0 0 0 1px rgba(226, 196, 104, .3), inset 0 0 0 7px var(--ink), inset 0 0 0 8px rgba(31, 181, 143, .3); }
.login .seal::before { content: ""; position: absolute; width: 560px; height: 560px; top: -170px; right: -190px; background: url(/static/guilloche.svg) center / contain no-repeat; z-index: -1; }
.login .seal .mark { width: 46px; height: 46px; background: url(/static/icon.svg) center / contain no-repeat; margin-bottom: auto; }
.login .seal .tag { font-size: 30px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; margin: 24px 0 14px; color: #fff; max-width: 16ch; }
.login .seal .facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; color: #B5C3D2; }
.login .seal .facts li { padding-left: 18px; position: relative; }
.login .seal .facts li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 2px; background: var(--mint); }
.login > .card { margin: 0; border-radius: 0 18px 18px 0; padding: 40px 34px; display: flex; flex-direction: column; justify-content: center; text-align: left; }
.login > .card h1 { margin-bottom: 8px; }
.login .trust { display: none; }
.login + .legal-links { margin-top: 22px; }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; margin-top: 18px; }
  .login .seal { border-radius: 16px 16px 0 0; min-height: 0; padding: 26px 22px 24px; }
  .login .seal .mark { margin-bottom: 0; }
  .login .seal .tag { font-size: 23px; margin-top: 14px; }
  .login .seal::before { width: 380px; height: 380px; top: -120px; right: -150px; }
  .login > .card { border-radius: 0 0 16px 16px; padding: 26px 22px; }
}
#gbtn { display: flex; justify-content: flex-start; align-items: center; min-height: 44px; }
.gwrap { margin: 22px 0 6px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); }
.ghint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
#gbtn svg { width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px; }
#gbtn iframe { max-width: 100%; }

/* ---------- อื่น ๆ ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 120; max-width: 92vw; box-shadow: 0 12px 32px rgba(0, 0, 0, .3); border-left: 3px solid var(--mint); }
.toast.bad { border-left-color: #F2867A; }
details { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; }
pre { background: var(--ink); color: #DCE6EE; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; border-left: 3px solid var(--mint); }
.bar { height: 8px; border-radius: 4px; background: var(--mint); min-width: 2px; }
.bars { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; font-size: 13.5px; }
progress { width: 100%; height: 8px; accent-color: var(--mint); }
a.btn { display: inline-block; text-decoration: none; }
a.btn.on { background: var(--ink-2); color: #fff; border-color: var(--ink-2); }
:root[data-theme="dark"] a.btn.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0 8px 0 0; vertical-align: middle; accent-color: var(--primary); }
.qr { background: #fff; display: inline-block; padding: 10px; border-radius: 10px; line-height: 0; border: 1px solid var(--line); }
.qr svg { max-width: 100%; height: auto; }

/* ป๊อปอัพ/แถบแดง: ต้องติดตั้ง/อัปเดต */
.readiness-bar { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; margin: 0; padding: 12px 18px; font-weight: 600; font-size: 15px;
  background: #C8261B; color: #fff; cursor: pointer; animation: tk-pulse 2s ease-in-out infinite; position: sticky; top: 0; z-index: 20; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readiness-bar:hover { border: 0; }
.readiness-bar.warn { background: #E8A13A; color: #1d1d1d; animation: none; }
@keyframes tk-pulse { 0%, 100% { background: #C8261B; } 50% { background: #A61D14; } }
@media (prefers-reduced-motion: reduce) { .readiness-bar { animation: none; } * { transition: none !important; } }
.modal-back { position: fixed; inset: 0; background: rgba(4, 10, 20, .66); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal { background: var(--panel); color: var(--text); border-radius: 16px; max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 24px 64px rgba(0, 0, 0, .45); }
.modal.danger { border: 3px solid #C8261B; }
.modal.danger h2 { color: #C8261B; margin-top: 0; font-size: 19px; }
:root[data-theme="dark"] .modal.danger h2 { color: #F2867A; }
.ready-item { border-radius: 10px; padding: 11px 14px; margin: 8px 0; }
.ready-item.critical { background: #FCE5E2; color: #6E1D14; border-left: 5px solid #C8261B; }
.ready-item.warning { background: #FBF0DA; color: #6A3A05; border-left: 5px solid #E8A13A; }
.ready-title { font-weight: 600; margin-bottom: 4px; }
.ready-fix { font-size: 14px; word-break: break-word; }

/* หน้านโยบาย/เงื่อนไข */
main.legal { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }
main.legal h1 { margin-top: 8px; }
main.legal h2 { font-size: 18px; margin: 28px 0 6px; }
main.legal p { margin: 6px 0; }
main.legal mark { background: #FCE5E2; color: #B42318; padding: 0 4px; border-radius: 4px; }
.legal-links { text-align: center; font-size: 13px; margin: 18px 0; }
.legal-links a { margin: 0 10px; color: var(--muted); }

@media (max-width: 420px) {
  .brand { font-size: 0; gap: 0; }
  .brand .mark { width: 32px; height: 32px; }
}
@media (max-width: 560px) {
  main { padding: 18px 14px 56px; }
  h1 { font-size: 22px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar .who, .brand small { display: none; }
  .brand { font-size: 15px; letter-spacing: .1em; }
  .topbar select { max-width: 104px; padding: 6px 8px; }
  .topbar button { padding: 6px 9px; }
  .stat .value { font-size: 22px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid > .hero { grid-column: 1 / -1; }
  .grid > .card { margin-bottom: 0; padding: 14px; }
  .topbar { flex-wrap: nowrap; }
  .topbar button { white-space: nowrap; font-size: 12.5px; }
  .hero .value { font-size: 28px; }
}

/* หน้าว่าง: บอกว่าต้องทำอะไรต่อ */
.empty { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 28px 20px 26px; text-align: center; color: var(--muted); background: var(--panel-2); margin: 4px 0 16px; }
.empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--panel) center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231FB58F' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M11 12l9-9M17 6l3 3M15 8l2 2'/%3E%3C/svg%3E"); }
.card .empty { margin: 0; }
.card > p.muted:first-child { margin-top: 0; }

/* ---------- เลือกบริการ: การ์ดพร้อมป้ายสีประจำค่าย ---------- */
.pgroup { font-size: 13px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; grid-column: 1 / -1; }
.pgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-bottom: 14px; }
.pcard { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; text-align: left; align-items: start; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; min-height: 0; }
.pcard:hover { border-color: var(--line-2); }
.pcard.on { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); background: var(--panel-2); }
.pcard .pbody { display: grid; gap: 2px; font-size: 13px; line-height: 1.45; }
.pcard .pbody strong { font-size: 15px; }
.pcard .pcode { grid-column: 2; font-size: 11px; color: var(--muted); }
.pbadge { --pc: #566577; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--pc); color: #fff;
  font: 700 18px/1 var(--font); flex: 0 0 auto; }
.pbadge.big { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; }
.pdetail { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; background: var(--panel-2); }
.pdetail .phead { align-items: center; flex-wrap: nowrap; }
.pdetail .phead > div { flex: 1 1 auto; }
.pdetail h2 { margin: 0; }
.steps { margin: 10px 0; padding-left: 22px; }
.steps li { margin: 4px 0; }
.prices { margin: 4px 0 0; padding-left: 20px; }
.keyhead { display: flex; gap: 12px; align-items: flex-start; }
.member { display: inline-flex; gap: 10px; align-items: center; }
.member.big h2 { margin: 0; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; object-fit: cover; flex: 0 0 auto; }
.member.big .avatar { width: 56px; height: 56px; font-size: 22px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
pre.wrap { white-space: pre-wrap; word-break: break-all; }
label.check { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.ua { font-size: 12px; }

/* ---------- หน้าเข้าสู่ระบบกลาง: ปุ่มค่าย OAuth ---------- */
.oauth-link { --pc: #333; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 320px; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; background: var(--pc); color: #fff; font-weight: 600; text-decoration: none; }
.oauth-link:hover { filter: brightness(1.08); }
.oauth-link .pbadge { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .2); font-size: 14px; }
/* ---------- หลังบ้าน: เชื่อมต่อค่าย ---------- */
details.integ > summary { cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; list-style: none; }
details.integ > summary::-webkit-details-marker { display: none; }
details.integ[open] > summary { margin-bottom: 8px; }
.copyrow input { font-size: 13px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; white-space: nowrap; }
.row.phead { flex-wrap: nowrap; align-items: center; }
.row.phead > .pbadge { flex: 0 0 auto; }
.row.phead > div { flex: 1 1 auto; min-width: 0; }
a.doclink { display: flex; gap: 14px; align-items: center; padding: 16px 18px; margin-bottom: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--primary); text-decoration: none; color: var(--text); }
a.doclink > span:last-child { display: grid; gap: 2px; }

/* ================= ยกระดับ UI: ไอคอน, หัวหน้า, (?) อธิบาย, แดชบอร์ด ================= */
.ico { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: 0 0 auto; }
.ico svg { width: 100%; height: 100%; }
.nav a { display: inline-flex; align-items: center; gap: 7px; }
.nav a .ico { opacity: .75; }
.nav a.on .ico { opacity: 1; color: var(--primary); }
@media (max-width: 640px) {
  .nav { padding: 0 6px; }
  .nav a { flex-direction: column; gap: 3px; padding: 9px 10px 7px; font-size: 12px; min-width: 64px; }
  .nav a .ico { width: 20px; height: 20px; }
}
/* หัวหน้า */
.phd { display: flex; gap: 14px; align-items: center; margin: 4px 0 18px; }
.phd-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(145deg, var(--ink-2), var(--ink)); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(226, 196, 104, .35); }
.phd-ico .ico { width: 24px; height: 24px; }
.phd-txt { flex: 1 1 auto; min-width: 0; }
.phd h1 { margin: 0; font-size: 24px; line-height: 1.25; }
.phd p { margin: 3px 0 0; color: var(--muted); font-size: 14.5px; }
.phd-act { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .phd { flex-wrap: wrap; } .phd h1 { font-size: 21px; } .phd-act { width: 100%; } }
/* (?) อธิบาย */
button.help { position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; min-height: 0; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); font: 700 12px/1 var(--font); cursor: help; vertical-align: middle; }
button.help:hover, button.help.open { color: var(--primary-text); background: var(--primary); border-color: var(--primary); }
button.help .tip { display: none; position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(300px, 80vw);
  background: var(--ink); color: #E6EDF3; font: 400 13px/1.5 var(--font); text-align: left; padding: 9px 12px; border-radius: 10px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); white-space: normal; }
button.help.open .tip { display: block; }
label.lh { display: flex; align-items: center; gap: 6px; }
/* แดชบอร์ดหน้าแรก */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow); }
.quick a:hover { border-color: var(--primary); }
.quick a .ico { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--ok-bg); color: var(--primary); box-sizing: border-box; }
.checklist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.checklist li .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); color: transparent; flex: 0 0 auto; }
.checklist li.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.checklist li.done .ct { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.checklist li .ct { flex: 1 1 auto; }
.checklist li a { font-size: 13.5px; white-space: nowrap; }
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--mint)); border-radius: 99px; }
.card.stat .label { display: flex; align-items: center; gap: 7px; }
.card.stat .label .ico { color: var(--primary); }
.trustbar { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 26px 0 6px; }
.trustbar span { display: inline-flex; align-items: center; gap: 6px; }
.trustbar .ico { color: var(--primary); width: 16px; height: 16px; }
@media (max-width: 640px) { .nav { gap: 6px; } .nav a { min-width: 74px; padding: 9px 6px 7px; font-size: 11.5px; line-height: 1.25; } }
/* ---------- หน้าเอกสารในหน้าร้าน ---------- */
a.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; border: 1px solid var(--line-2); color: var(--text); background: var(--panel); }
a.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.docs-hero { background: var(--ink) url(/static/guilloche.svg) right center / 460px auto no-repeat; color: #E6EDF3; border-radius: 16px; padding: 22px 24px; margin-bottom: 16px; display: grid; gap: 14px; }
.docs-hero h2 { margin: 0 0 4px; font-size: 21px; }
.docs-hero p { margin: 0; color: #C9D6E3; max-width: 70ch; }
.docs-hero .kv { display: grid; gap: 8px; }
.docs-hero .kv > div { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.docs-hero .kv .muted { color: #92A3B8; min-width: 70px; }
.docs-hero code { background: rgba(255, 255, 255, .1); color: #fff; padding: 4px 9px; border-radius: 7px; word-break: break-all; }
.docs-hero button.small { background: transparent; color: #E6EDF3; border-color: rgba(255, 255, 255, .25); }
.pairgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pairgrid > div { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.pairgrid p { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
h2.sect { margin: 22px 0 10px; font-size: 18px; }
.docgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin-bottom: 16px; }
a.doccard { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
a.doccard:hover { border-color: var(--primary); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { a.doccard { transition: none; } a.doccard:hover { transform: none; } }
.dc-head { display: flex; gap: 12px; align-items: center; }
.dc-head > div { display: grid; }
.dc-head strong { font-size: 16px; }
.dc-head code { font-size: 12px; }
a.doccard p { margin: 0; font-size: 14px; color: var(--muted); }
.steps.small { font-size: 13px; margin: 0; padding-left: 20px; }
.eps { display: grid; gap: 4px; }
.eps .ep { display: flex; gap: 6px; align-items: center; font-size: 12.5px; }
.eps .m { font: 700 10.5px/1 var(--mono); padding: 4px 6px; border-radius: 5px; color: #fff; }
.m-get { background: #0B7A63; } .m-post { background: #155EEF; } .m-delete { background: #B42318; }
.dc-more { margin-top: auto; color: var(--primary); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
pre.code-dark { background: #0B1626; color: #E6EDF3; border-radius: 12px; padding: 14px 16px; overflow-x: auto; }
.keyids { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.keyids > span { display: inline-flex; gap: 6px; align-items: center; }
.keyids code { font-size: 12px; background: var(--panel-2); padding: 2px 6px; border-radius: 6px; }
button.small.ghost { padding: 2px 8px; min-height: 0; font-size: 12px; }
.small { font-size: 13px; }
/* ---------- ยืนยันโดเมน ---------- */
.dom { border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: var(--panel-2); }
.dom.need { border-color: var(--warn); background: var(--warn-bg); }
.dom.ok { display: flex; gap: 8px; align-items: center; border-style: solid; border-color: transparent; background: var(--ok-bg); color: var(--ok); font-weight: 600; padding: 9px 12px; }
.dom-head { display: flex; gap: 8px; align-items: center; }
.dom .steps { margin: 10px 0; }
/* ---------- เติมเครดิต / ประวัติ / ล็อกอิน ---------- */
.topup-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.stepno { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--gold-2); font-size: 15px; vertical-align: middle; }
.bankcards { display: grid; gap: 12px; }
.bankcard { position: relative; border-radius: 16px; padding: 18px 20px; color: #fff; background: linear-gradient(135deg, #0E1A2B 0%, #16314F 55%, #0B7A63 140%); box-shadow: 0 16px 32px -18px rgba(14, 26, 43, .7); overflow: hidden; }
.bankcard::before { content: ""; position: absolute; inset: 0; background: url(/static/guilloche.svg) right -60px center / 300px auto no-repeat; opacity: .55; }
.bankcard > * { position: relative; }
.bc-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; letter-spacing: .06em; }
.bc-chip { width: 34px; height: 24px; border-radius: 5px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.bc-no { font: 600 22px/1.3 var(--mono); letter-spacing: .08em; margin: 16px 0 4px; }
.bc-name { color: #C9D6E3; font-size: 14px; }
.bankcard button.small.ghost { position: absolute; right: 14px; bottom: 14px; background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3); }
.tu-rules { margin: 12px 0 0; padding-left: 18px; }
label.dropzone { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 22px 16px; border: 2px dashed var(--line-2); border-radius: 14px; background: var(--panel-2); cursor: pointer; }
label.dropzone:hover { border-color: var(--primary); }
label.dropzone .ico { width: 34px; height: 34px; color: var(--primary); }
label.dropzone input[type=file] { max-width: 100%; margin-top: 8px; }
button.big { min-height: 48px; padding: 0 22px; font-size: 16px; display: inline-flex; align-items: center; gap: 4px; }
.result { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; margin-top: 12px; }
.result.ok { background: var(--ok-bg); color: var(--ok); } .result.bad { background: var(--bad-bg); color: var(--bad); }
.result .ico { width: 28px; height: 28px; }
td.num.pos, .value.pos { color: var(--ok); } td.num.neg { color: var(--text); }
.row.tb-head { align-items: end; justify-content: space-between; margin-bottom: 8px; }
.row.tb-head > h2 { flex: 1 1 auto; margin: 0; }
.row.tb-head > div, .row.tb-head > input { flex: 0 1 240px; }
.seal .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; position: relative; }
.phd-txt { flex: 1 1 0; }
@media (max-width: 640px) { .phd-ico { width: 42px; height: 42px; } .phd-act { flex: 1 0 100%; } }
.card.mhead { display: flex; align-items: center; }
.card.mhead h1 { margin: 0; font-size: 22px; }
a.member { color: var(--text); text-decoration: none; }
a.member:hover strong { color: var(--primary); }
/* ---------- ทัวร์สอนใช้งาน: ไฮไลต์ + นิ้วชี้ + กล่องอธิบาย ---------- */
.tourbtn { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1A1406; border: 0; font-weight: 700; border-radius: 999px; padding: 7px 14px; min-height: 0; cursor: pointer; }
.tour { position: fixed; inset: 0; z-index: 1000; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(6, 13, 24, .66), 0 0 0 3px var(--gold-2), 0 0 24px 6px rgba(226, 196, 104, .55);
  transition: left .3s, top .3s, width .3s, height .3s; pointer-events: none; }
.tour-finger { position: fixed; font-size: 34px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .45)); pointer-events: none; z-index: 1002; }
.tour-box { position: fixed; z-index: 1003; background: var(--panel); color: var(--text); border-radius: 16px; padding: 16px 16px 12px; box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .55);
  border-top: 4px solid var(--gold-2); max-width: calc(100vw - 24px); }
.tour-box h3 { margin: 6px 0 6px; font-size: 18px; }
.tour-box p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.6; color: var(--text); }
.tour-prog { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.tour-bar { display: block; height: 5px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.tour-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--mint)); }
.tour-act { display: flex; gap: 8px; align-items: center; }
.tour-act .sp { flex: 1 1 auto; }
@media (prefers-reduced-motion: no-preference) {
  .tour-finger.up { animation: tapUp 1s ease-in-out infinite; }
  .tour-finger:not(.up) { animation: tapDown 1s ease-in-out infinite; }
}
@keyframes tapUp { 0%, 100% { transform: translateY(6px); } 50% { transform: translateY(-4px); } }
@keyframes tapDown { 0%, 100% { transform: translateY(-6px); } 50% { transform: translateY(4px); } }
@media (max-width: 640px) { .tourbtn span { display: none; } }

/* กระเป๋าคริปโต */
.wallets { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin: 14px 0; }
.wallet .w-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.wallet .w-head h1 { margin: 0; }
.wallet .w-bal { text-align: right; }
.wallet .w-bal .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wallet .w-note { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; margin: 10px 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wallet .w-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; margin: 8px 0; }
.wallet code { overflow-wrap: anywhere; }
.wallet .w-addr { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; margin-top: 12px; }
.wallet .w-addr .qr svg, .qrbox .qr svg { width: 160px; height: 160px; background: #fff; border-radius: 10px; }
.wallet code.big { display: block; font-size: 15px; padding: 10px 12px; background: var(--panel-2); border-radius: 10px; }
.qrbox summary { cursor: pointer; }
.totals table td.num strong { font-size: 16px; }
@media (max-width: 560px) { .wallet .w-addr { grid-template-columns: 1fr; justify-items: center; } }
.tlist, .hlist { display: grid; gap: 0; }
.trow { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.trow .tamt { text-align: right; font-variant-numeric: tabular-nums; }
.trow .tamt strong { font-size: 18px; }
.hrow { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.hrow:first-child { border-top: 0; }
.hrow .htop { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.hrow .htop strong { font-size: 16px; }
.hrow .hmeta { color: var(--muted); font-size: 13px; }
.hrow .mono { overflow-wrap: anywhere; color: var(--muted); }
.hnote { background: var(--panel-2); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.hnote.bad { color: var(--bad, #c0392b); }
.pos { color: var(--ok, #138a5b); }
