:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1d21;
  --muted: #555b66;
  --line: #c9ced6;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --alert-bg: #fdecec;
  --alert-text: #8a1c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --card: #1f2228;
    --text: #eceef2;
    --muted: #b3b9c4;
    --line: #4a505b;
    --accent: #7db7f5;
    --accent-text: #0d1117;
    --alert-bg: #3a1e1e;
    --alert-text: #ffc9c9;
  }
}
/* Google Sans (OFL, Thai and Latin), the suite's font, served from this service itself (the CSP allows fonts from
   'self' only): the same cut as the Studio's. */
@font-face {
  font-family: "Google Sans";
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/GoogleSans-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Google Sans";
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/GoogleSans-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "Google Sans";
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/GoogleSans-Bold.ttf") format("truetype");
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", system-ui, "Noto Sans Thai", sans-serif;
  line-height: 1.6;
}
.card {
  width: 100%;
  max-width: 26rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.75rem 1.5rem;
}
.brand { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
h1 { margin: 0 0 0.5rem; font-size: 1.5rem; line-height: 1.3; }
.lead { margin-top: 0; color: var(--muted); }
.stack { display: grid; gap: 0.5rem; margin-top: 1rem; }
label { font-weight: 600; }
input {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--text);
}
button {
  font: inherit;
  font-weight: 600;
  margin-top: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); }
a.button {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
}
.or { margin: 1.25rem 0 0; color: var(--muted); text-align: center; font-size: 0.9rem; }
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.alert {
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  background: var(--alert-bg);
  color: var(--alert-text);
}
a { color: var(--accent); }

/* The admin area: a wider page with a bar on top. */
body.admin { display: block; place-items: normal; padding: 0; }
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.bar .brand { margin: 0; font-weight: 600; color: var(--text); }
.bar nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.bar nav a { text-decoration: none; padding: 0.25rem 0; }
.bar nav a[aria-current="page"] { font-weight: 700; border-bottom: 2px solid var(--accent); }
.bar form.inline { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.me { color: var(--muted); }
main.wide { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.form { max-width: 34rem; }
.section { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); max-width: 34rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
fieldset { border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.5rem 0.75rem 0.75rem; margin: 0.5rem 0 0; }
legend { font-weight: 600; padding: 0 0.25rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; margin-top: 0.35rem; }
label.check input { width: 1.1rem; height: 1.1rem; }
textarea, select {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--text);
}
textarea { font-family: ui-monospace, monospace; font-size: 0.9rem; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 0.95rem; }
caption { text-align: left; padding: 0.5rem 0; color: var(--muted); }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
th { font-weight: 600; }
tr.refused td { background: var(--alert-bg); color: var(--alert-text); }
.tag { display: inline-block; font-size: 0.8rem; padding: 0 0.4rem; border: 1px solid var(--line); border-radius: 0.3rem; color: var(--muted); }
.off { color: var(--alert-text); font-weight: 600; }
.block { display: block; }
code { font-family: ui-monospace, monospace; font-size: 0.9em; overflow-wrap: anywhere; }
.notice { padding: 0.6rem 0.8rem; border-radius: 0.5rem; border: 1px solid var(--accent); }
button.small, .small { margin-top: 0; padding: 0.35rem 0.75rem; font-size: 0.9rem; }
a.inline-button { display: inline-block; margin-top: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
