:root {
  color-scheme: light;
  --canvas: #f1f1fa;
  --white: #fff;
  --ink: #131429;
  --muted: #55596e;
  --line: #d2d5e3;
  --violet: #5528d0;
  --violet-strong: #4422b2;
  --danger: #a5223f;
  font-family: system-ui, "Leelawadee UI", "Noto Sans Thai", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button, input, select { min-height: 40px; }
:focus-visible { outline: 3px solid #8869e8; outline-offset: 2px; }
input, select {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid #bfc4d5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input::placeholder { color: #656a80; }
.wrap { width: min(1220px, calc(100% - 48px)); margin-inline: auto; }
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top-inner, .account { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.top-inner { min-height: 56px; }
.brand { color: var(--ink); text-decoration: none; font-size: 23px; font-weight: 780; white-space: nowrap; }
.brand strong { font-size: 29px; letter-spacing: -.055em; color: var(--violet); margin-right: 6px; }
.account span { overflow-wrap: anywhere; }
.outline, .primary {
  border: 1px solid var(--violet);
  border-radius: 8px;
  color: var(--violet);
  background: var(--white);
  padding: 6px 15px;
  font-weight: 700;
}
.primary { background: var(--violet); color: #fff; }
.primary:hover:enabled { background: var(--violet-strong); }
.outline:hover:enabled { background: #f6f2ff; }
.auth-card {
  max-width: 486px;
  margin: 35px auto;
  padding: 26px 37px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 6px 15px #24234d13;
}
h1 { font-size: clamp(1.9rem, 4.4vw, 2.5rem); line-height: 1.25; letter-spacing: -.018em; margin: 0; }
.auth-card h1 { font-size: 2rem; margin-bottom: 14px; }
.auth-card label { display: block; margin: 10px 0 4px; font-weight: 700; }
.auth-card form > button { width: 100%; margin-top: 10px; }
.auth-card form > .primary { margin-top: 18px; }
.password-field, .search { position: relative; }
.password-field input { padding-right: 45px; }
.password-field button {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 43px;
  border: 0;
  color: var(--muted);
  background: transparent;
}
svg { width: 21px; height: 21px; }
#password-hint { color: var(--muted); margin: 8px 0 0; }
#auth-error, #workspace-error { color: var(--danger); }
.page-head { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
#description { font-size: 1.15rem; }
#last-sync { align-self: flex-start; padding-top: 9px; }
.views { display: flex; border-bottom: 1px solid #cbd0e1; margin: 12px 0 20px; }
.views button {
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  font-weight: 750;
  padding: 9px 23px;
  border-bottom: 3px solid transparent;
}
.views button[aria-pressed="true"] { color: var(--violet-strong); border-color: var(--violet); }
.surface { border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; background: var(--white); }
.toolbar, #catalog-controls, #history-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}
.toolbar { margin-bottom: 15px; justify-content: space-between; }
#catalog-controls { flex: 1; }
#catalog-controls select { max-width: 24%; }
.search { flex: 1; }
.search input { padding-left: 41px; }
.search svg { position: absolute; top: 9px; left: 12px; color: var(--muted); pointer-events: none; }
#row-count { font-weight: 700; min-width: 80px; text-align: end; white-space: nowrap; }
.table-scroll { overflow-x: auto; border-radius: 7px; }
table { border-collapse: collapse; width: 100%; min-width: 660px; }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; }
th { background: #ebebf4; font-weight: 800; white-space: nowrap; }
td { border-bottom: 1px solid #e1e2ee; overflow-wrap: anywhere; }
td:first-child { width: 36%; }
#workspace[data-view="catalog"] td:nth-child(2) { white-space: nowrap; }
td a, .table-link { color: var(--violet-strong); }
.table-link { border: 0; background: none; padding: 0; text-align: left; min-height: auto; text-decoration: underline; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #f0eef7; color: #53476f; white-space: nowrap; }
.status.good { background: #dcf8e4; color: #12672a; }
.status.bad { background: #ffe6ec; color: #8c2340; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 17px; color: var(--muted); }
.pagination div, .pagination button { display: flex; align-items: center; gap: 8px; }
.pagination button { border-color: #cdd1de; color: #454b65; min-height: 36px; }
.pagination svg { width: 16px; height: 16px; }
#page-current { color: #fff; background: var(--violet); min-width: 34px; padding: 6px; text-align: center; border-radius: 7px; }
#empty-state { padding: 10px 12px; color: var(--muted); }
#workspace { padding-bottom: 30px; }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  .page-head { display: block; }
  #last-sync { padding-top: 3px; }
  .toolbar { flex-wrap: wrap; }
  #catalog-controls { flex-wrap: wrap; flex-basis: 100%; }
  #catalog-controls select { width: calc(50% - 6px); max-width: none; }
  .search { flex-basis: 100%; }
  .surface { padding: 12px; }
  #workspace[data-view="catalog"] table { min-width: 620px; }
  #workspace[data-view="catalog"] td:first-child { width: 24%; }
}
@media (max-width: 500px) {
  .top-inner, .account { gap: 8px; }
  .account { justify-content: flex-end; flex-wrap: wrap; padding: 5px 0; font-size: .85rem; }
  .account span { text-align: right; }
  .account button { min-height: 32px; padding: 4px 8px; }
  .brand { font-size: 16px; }
  .brand strong { font-size: 20px; margin-right: 3px; }
  .auth-card { padding: 22px; }
  .pagination button { padding: 5px 7px; }
}
