:root {
  --bg: #f7f6f2; --surface: #ffffff; --text: #1d1d1b; --muted: #6b6a64; --line: #e3e1da;
  --accent: #1f4d3a; --accent-text: #ffffff; --ok: #1f7a4d; --err: #b3261e; --warn: #8a5a00; --note: #eef4ef;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151614; --surface: #1f201d; --text: #ecebe6; --muted: #a3a29b; --line: #34352f;
    --accent: #8fd1ad; --accent-text: #10241a; --ok: #7fd3a4; --err: #ff8a80; --warn: #e6b45a; --note: #1d2a22; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "IBM Plex Sans Thai", system-ui, sans-serif; }
a { color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; text-decoration: none; color: var(--text); letter-spacing: .02em; }
.top nav { display: flex; gap: 16px; align-items: center; }
.top nav a { text-decoration: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--err); vertical-align: middle; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.6rem; margin: 0 0 12px; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 0 0 12px; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 0 0 16px; }
.note { background: var(--note); }
.muted, small { color: var(--muted); }
small { display: block; font-size: .85rem; margin-top: 4px; }
.form label { display: block; margin: 0 0 14px; font-weight: 500; }
.form label.inline, label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 0 16px 6px 0; }
input, textarea, select { width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
input[type=checkbox] { width: auto; margin: 0; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.req { color: var(--err); }
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn.small { padding: 6px 12px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 16px; }
.row form { margin: 0; }
.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }
.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; border: 1px solid; }
.flash.ok { color: var(--ok); border-color: currentColor; }
.flash.err { color: var(--err); border-color: currentColor; }
.sites { list-style: none; padding: 0; margin: 0; }
.sites li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.badge { font-size: .8rem; padding: 2px 10px; border-radius: 99px; border: 1px solid currentColor; }
.badge.done { color: var(--ok); } .badge.error { color: var(--err); } .badge.working, .badge.new { color: var(--warn); }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.viewport-switch { display: flex; gap: 6px; margin-bottom: 8px; }
.viewport-switch button { font: inherit; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.viewport-switch button.on { border-color: var(--accent); color: var(--accent); }
.frame-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; margin-bottom: 16px; display: flex; justify-content: center; }
.frame-wrap iframe { width: 100%; height: 75vh; border: 0; background: #fff; transition: width .2s; }
pre { white-space: pre-wrap; font-size: .9rem; }
details summary { cursor: pointer; font-weight: 500; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.danger { color: var(--err); }
code { font-size: .9em; }
.inline-form { display: inline; margin: 0; }
.top nav .link { color: var(--accent); text-decoration: none; }
.auth { max-width: 420px; margin: 8vh auto 0; }
.brand.big { font-size: 1.4rem; font-weight: 600; text-align: center; margin: 0 0 16px; }
.users { list-style: none; padding: 0; margin: 0 0 16px; }
.users li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
