:root {
  --paper: oklch(97.5% 0.008 85);
  --paper-2: oklch(94% 0.012 250);
  --ink: oklch(27% 0.09 262);        /* logo navy */
  --ink-soft: oklch(47% 0.04 262);
  --line: oklch(84% 0.02 80);
  --signal: oklch(68% 0.19 48);       /* logo orange */
  --signal-ink: oklch(50% 0.16 42);
  --ok: oklch(55% 0.13 150);
  --bad: oklch(52% 0.19 25);
  --radius-s: 4px;
  --radius-l: 14px;
  --font: "Noto Sans Thai", "Leelawadee UI", "Sukhumvit Set", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper);
  background-image: radial-gradient(oklch(88% 0.02 80) 1px, transparent 1px);
  background-size: 18px 18px; line-height: 1.55;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.top {
  display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap;
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 1.5rem; border-bottom: 2px solid var(--ink);
}
.brand { display: flex; flex-direction: column; gap: .35rem; }
.brand h1 { margin: 0; line-height: 0; }
.logo { display: block; height: clamp(64px, 5rem + 3vw, 112px); width: auto; }
h1 { margin: 0; font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); letter-spacing: -.03em; line-height: .95; }
.sub { margin: .2rem 0 0; color: var(--ink-soft); }
.credit { display: flex; align-items: baseline; gap: .6rem; }
.credit .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); }
.num { font-family: var(--mono); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
main { padding: 1.5rem clamp(1rem, 4vw, 3rem) 4rem; max-width: 1200px; }
.card {
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--radius-l);
  padding: 1.4rem; box-shadow: 5px 5px 0 var(--ink);
}
h2 { margin: 0 0 .9rem; font-size: 1.05rem; }
.key { margin-bottom: 1.5rem; box-shadow: 3px 3px 0 var(--line); border-color: var(--line); }
.row { display: flex; gap: .6rem; }
.row input { flex: 1; }
.hint { color: var(--ink-soft); font-size: .82rem; margin: .4rem 0 0; font-weight: 400; }
.tabs { display: flex; gap: .25rem; margin-bottom: -1.5px; position: relative; z-index: 1; }
.tabs button {
  border: 1.5px solid var(--ink); border-bottom: none; border-radius: 10px 10px 0 0;
  background: var(--paper-2); color: var(--ink-soft); padding: .55rem 1.3rem; box-shadow: none;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.panel { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem;
  border-top: 1.5px solid var(--ink); padding-top: 1.5rem; }
.panel[hidden] { display: none; }
@media (max-width: 820px) { .panel { grid-template-columns: 1fr; } }
.field { margin-bottom: 1.1rem; }
label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: oklch(99% 0.005 85);
  border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: .6rem .7rem;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
textarea { resize: vertical; }
#recipients { font-family: var(--mono); font-size: .9rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px oklch(64% 0.19 42 / .2);
}
.meta { margin: .3rem 0 0; font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); text-align: right; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border: 1.5px solid var(--ink); border-radius: var(--radius-s);
  background: var(--paper); color: var(--ink); padding: .6rem 1.1rem;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background 120ms;
  box-shadow: 2px 2px 0 var(--ink);
}
button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
button:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
button:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: progress; transform: none; }
.primary { background: var(--signal); width: 100%; padding: .85rem; font-size: 1.05rem; }
.ghost { box-shadow: none; border-color: transparent; padding: .2rem .5rem; font-size: 1.2rem; }
.log { align-self: start; box-shadow: 5px 5px 0 var(--signal); }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.log-list li { border-top: 1px dashed var(--line); padding-top: .7rem; font-size: .88rem; }
.log-list .head { display: flex; justify-content: space-between; gap: .5rem; }
.log-list code { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); word-break: break-all; }
.badge { font-family: var(--mono); font-size: .72rem; padding: .1rem .45rem; border-radius: 99px;
  border: 1px solid currentColor; text-transform: uppercase; }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); } .badge.wait { color: var(--signal-ink); }
.log-list button { margin-top: .4rem; padding: .25rem .6rem; font-size: .8rem; box-shadow: none; }
#tab-otp { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { #tab-otp { grid-template-columns: 1fr; } }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); opacity: 0;
  background: var(--ink); color: var(--paper); padding: .75rem 1.2rem; border-radius: var(--radius-s);
  max-width: min(90vw, 520px); transition: transform 300ms var(--ease), opacity 300ms var(--ease);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--bad); }
.doclink { margin-left: auto; color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--signal); }
.doclink:hover { color: var(--signal-ink); }
