@font-face { font-family: 'Prompt'; font-weight: 400; font-display: swap; src: url('../fonts/prompt-thai-400-normal.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Prompt'; font-weight: 600; font-display: swap; src: url('../fonts/prompt-thai-600-normal.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Prompt'; font-weight: 400; font-display: swap; src: url('../fonts/prompt-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: 'Prompt'; font-weight: 600; font-display: swap; src: url('../fonts/prompt-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; }

:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #1b1f27; --muted: #667085; --line: #e2e5ea;
  --brand: #3b5bdb; --brand-text: #ffffff; --ok: #1a7f4b; --ok-bg: #e3f6ec; --bad: #b42318; --bad-bg: #fde8e6; --warn-bg: #fff4d6;
  --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11141a; --card: #1a1f28; --text: #e8eaee; --muted: #9aa3b2; --line: #2b323e; --brand: #6d8bff; --brand-text: #0e1220; --ok: #5fd39a; --ok-bg: #12301f; --bad: #ff8b7d; --bad-bg: #3a1714; --warn-bg: #3a3012; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Prompt', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.login-box { max-width: 380px; margin: 12vh auto 0; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.between { justify-content: space-between; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { color: var(--muted); font-weight: 400; font-size: 12px; white-space: nowrap; }
td.num, th.num { text-align: right; }
.slug { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; }
.badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.suspended { background: var(--bad-bg); color: var(--bad); }
.msg { padding: 9px 12px; border-radius: 8px; margin: 12px 0 0; font-size: 14px; }
.msg.err { background: var(--bad-bg); color: var(--bad); }
.msg.info { background: var(--warn-bg); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); width: min(520px, 94vw); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { font-size: 18px; margin-bottom: 8px; }
.qr { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 8px; margin: 10px 0; }
.secret { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; word-break: break-all; font-size: 13px; background: var(--bg); padding: 8px; border-radius: 6px; }
.adminrow { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* v53 ตัวแก้ไขข้อมูลตาราง */
button, input, textarea, select { font: inherit; color: inherit; }
select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input:disabled, textarea:disabled, select:disabled { opacity: .65; cursor: not-allowed; }
input[type='checkbox'] { width: auto; margin: 0 4px 0 0; vertical-align: middle; }
.wrap.wide { max-width: 1500px; }
.grow { flex: 1 1 220px; min-width: 0; }
.nowrap { flex-wrap: nowrap; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar > div { min-width: 170px; }
.toolbar label { margin-top: 0; }
.toolbar label.ghost { visibility: hidden; }
.toolbar form.row { flex-wrap: nowrap; }
.card.busy { opacity: .6; pointer-events: none; }
table.data { min-width: 900px; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--brand); }
table.data td { font-size: 13px; white-space: nowrap; }
table.data td.act { position: sticky; left: 0; background: var(--card); z-index: 1; }
.cell { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.nullv { color: var(--muted); font-style: italic; font-size: 12px; }
.pager { margin-top: 12px; }
dialog.wide { width: min(860px, 96vw); max-height: 92vh; overflow-y: auto; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; margin-top: 4px; }
.formgrid .f { min-width: 0; }
.formgrid textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; resize: vertical; }
.chk { display: inline-block; margin: 6px 0 0; font-size: 12px; cursor: pointer; }
