:root {
  --ink: #0f1720;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #d7dde5;
  --text: #14202b;
  --muted: #5b6775;
  --accent: #0f6e56;
  --accent-soft: #14967a;
  --warn: #b45309;
  --danger: #b91c1c;
  --hint-bg: #ecfdf5;
  --hint-border: #6ee7b7;
  --font: "Sarabun", "Be Vietnam Pro", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --max: 56rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, #eef2f6 0%, #e7edf3 100%);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); }

.pad-top {
  background: var(--ink);
  color: #f8fafc;
  padding: 0.75rem 0;
}

.pad-top .wrap {
  width: min(100% - 1.5rem, 72rem);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.pad-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.pad-brand span { color: #34d399; }

.pad-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pad-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.92rem;
}

.pad-nav a:hover { color: #fff; }

.wrap {
  width: min(100% - 1.5rem, var(--max));
  margin-inline: auto;
  padding: 1.25rem 0 2.5rem;
}

.lab-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
}

.lab-sub {
  margin: 0 0 1rem;
  color: var(--muted);
}

.hint {
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: 0.4rem;
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.hint code,
.mono {
  font-family: var(--mono);
  font-size: 0.88em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1.1rem 1.15rem;
  margin-bottom: 1rem;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

label {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font: inherit;
  background: #fff;
}

textarea { min-height: 5rem; resize: vertical; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn:hover { background: var(--accent-soft); }

.btn.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.btn.warn { background: var(--warn); }
.btn.danger { background: var(--danger); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  min-height: 1.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.status.ok { color: var(--accent); }
.status.err { color: var(--danger); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.data th,
table.data td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

table.data th { background: var(--panel-2); }

.module-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .module-grid { grid-template-columns: 1fr 1fr; }
}

.module-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.95rem 1rem;
}

.module-card:hover { border-color: var(--accent-soft); }

.module-card strong {
  display: block;
  margin-bottom: 0.25rem;
}

.module-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--panel);
}

.map-table th,
.map-table td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
  vertical-align: top;
}

.map-table th { background: var(--panel-2); text-align: left; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 0.5rem;
  padding: 1.1rem;
  width: min(100%, 24rem);
  border: 1px solid var(--line);
}

.progress {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.progress .step {
  flex: 1;
  height: 0.45rem;
  border-radius: 999px;
  background: #dbe3ec;
}

.progress .step.on { background: var(--accent); }

.wizard-pane { display: none; }
.wizard-pane.active { display: block; }

.iframe-box {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: #fff;
}

.ocr-img {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.countdown {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.captcha-code {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  background: #0f1720;
  color: #fbbf24;
  border-radius: 0.35rem;
  font-family: var(--mono);
  font-size: 1.35rem;
  letter-spacing: 0.18em;
}

pre.response {
  background: #0f1720;
  color: #e2e8f0;
  padding: 0.85rem;
  border-radius: 0.4rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.hover-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10rem;
  padding: 0.85rem 1.1rem;
  border: 2px dashed var(--accent);
  border-radius: 0.4rem;
  background: #ecfdf5;
  cursor: default;
  position: relative;
}

.hover-target .tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  background: #0f1720;
  color: #f8fafc;
  padding: 0.4rem 0.65rem;
  border-radius: 0.3rem;
  font-size: 0.88rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.hover-target:hover .tooltip,
.hover-target.show-tip .tooltip {
  opacity: 1;
}

#shadow-host {
  min-height: 8rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.75rem;
  background: #fff;
}

select[multiple] {
  min-height: 8rem;
}
