:root {
  --paper: #f4f1e9;
  --ink: #192c37;
  --muted: #53666d;
  --line: #c9d0ca;
  --accent: #a53520;
  --mint: #dce8dc;
  --white: #fffdf8;
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  padding: 12px 17px;
  border-radius: 5px;
  font-weight: 650;
  min-height: 44px;
}
button:hover {
  background: #304c57;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.secondary {
  background: transparent;
  color: var(--ink);
}
.secondary:hover {
  background: var(--mint);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-size: 21px;
  letter-spacing: -0.5px;
}
h3 {
  font-size: 16px;
}
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 4vw;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  text-decoration: none;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1.5px;
}
.wordmark span {
  font-weight: 400;
  color: var(--muted);
}
.identity {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 12px;
}
.badge,
.preview-mark {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  border: 1px solid #8ba68d;
  padding: 7px 10px;
  background: var(--mint);
}
.studio main {
  padding: 0 4vw;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  padding: 38px 0 32px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
}
.intro h1 {
  font-family: Georgia, serif;
  font-size: clamp(38px, 4.5vw, 66px);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -2px;
  margin: 0;
}
.intro h1 em {
  color: var(--accent);
  font-weight: 400;
}
.intro-copy {
  max-width: 370px;
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}
.intro-copy strong {
  display: block;
  color: var(--ink);
  margin-top: 12px;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(460px, 1.5fr);
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 15px 40px #192c3709;
}
.source-panel {
  border-right: 1px solid var(--line);
  padding: 24px;
}
.preview-panel {
  padding: 24px;
  min-width: 0;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}
.panel-heading h2 {
  margin: 0;
}
.panel-heading .eyebrow {
  margin-bottom: 5px;
}
.select-label {
  font-size: 11px;
  color: var(--muted);
}
select {
  display: block;
  max-width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px;
  color: var(--ink);
  min-height: 42px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
input {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #a2b3b5;
  border-radius: 4px;
  margin-top: 6px;
  background: #fff;
  color: var(--ink);
}
input[type="checkbox"] {
  width: 22px;
  height: 22px;
}
.file-label {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0;
}
.file-label input {
  padding: 6px;
  font-size: 12px;
}
textarea {
  width: 100%;
  height: 460px;
  resize: vertical;
  background: #182a34;
  color: #dfebe7;
  border: 0;
  border-radius: 5px;
  padding: 18px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.toolbar button {
  flex: 1;
}
#issues {
  white-space: pre-wrap;
  color: #8f2418;
  font-size: 13px;
  overflow-wrap: anywhere;
  margin-top: 16px;
}
.version-panel {
  margin-top: 25px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.version-panel p {
  font-size: 12px;
  color: var(--muted);
}
.version-panel label {
  margin-bottom: 12px;
}
.version-panel select {
  width: 100%;
}
#active-state {
  margin-top: 14px;
}
#status {
  background: var(--mint);
  padding: 12px 14px;
  border-left: 3px solid #698a70;
  font-size: 13px;
  margin-bottom: 14px;
}
iframe {
  width: 100%;
  height: 840px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 4px;
}
.records {
  padding-top: 24px;
}
#stock {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stock p {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  padding: 10px;
  background: var(--paper);
}
#receipts {
  padding-left: 20px;
  font-size: 13px;
}
#receipts li {
  margin-bottom: 14px;
}
details {
  margin-top: 5px;
}
summary {
  cursor: pointer;
  color: var(--muted);
}
pre {
  font:
    12px/1.5 "SFMono-Regular",
    Consolas,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 280px;
  overflow: auto;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 4vw;
  font-size: 11px;
  color: var(--muted);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: min(560px, 90vw);
  padding: 30px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 20px 100px #0004;
}
dialog::backdrop {
  background: #12222dcc;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.renderer {
  padding: 24px;
  background: var(--paper);
}
.app-heading h1 {
  font:
    400 36px/1.13 Georgia,
    serif;
  letter-spacing: -1px;
  margin-bottom: 20px;
}
.app-heading nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  padding-bottom: 16px;
}
.nav-button {
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  min-height: 38px;
  padding: 7px 13px;
}
.nav-button[aria-current="page"] {
  background: var(--ink);
  color: var(--white);
}
.blank {
  text-align: center;
  padding: 60px 25px;
  color: var(--muted);
}
.blank > span {
  font:
    60px Georgia,
    serif;
  color: var(--accent);
}
.blank h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 26px;
}
.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.app-card {
  background: var(--white);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.app-card h2 {
  font-size: 17px;
}
.app-copy {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.app-action {
  text-align: left;
  display: flex;
  justify-content: space-between;
}
.app-action::after {
  content: "↗";
  font-weight: 400;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
td,
th {
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.small {
  font-size: 12px;
  padding: 7px 10px;
  min-height: 38px;
}
.record-card {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.record-card p {
  margin: 0 0 8px;
  font-size: 13px;
}
@media (min-width: 720px) {
  .app-layout.counter {
    grid-template-columns: 1fr 1fr;
  }
  .app-card,
  .app-copy,
  .wide {
    grid-column: 1/-1;
  }
}
@media (max-width: 900px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .source-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  textarea {
    height: 300px;
  }
  .intro {
    align-items: start;
  }
  .intro-copy {
    max-width: 310px;
  }
  .identity {
    flex-direction: column;
    gap: 4px;
    align-items: end;
  }
}
@media (max-width: 520px) {
  .masthead {
    padding: 16px;
  }
  .wordmark {
    font-size: 23px;
  }
  .identity {
    font-size: 10px;
  }
  .studio main {
    padding: 0 12px;
  }
  .intro {
    padding: 28px 5px;
    display: block;
  }
  .intro-copy {
    margin-top: 22px;
    max-width: 100%;
  }
  .source-panel,
  .preview-panel {
    padding: 16px;
  }
  .panel-heading {
    flex-wrap: wrap;
  }
  .preview-mark {
    margin-top: 4px;
  }
  .toolbar {
    flex-direction: column;
  }
  .renderer {
    padding: 16px;
  }
  .app-heading h1 {
    font-size: 30px;
  }
  footer {
    display: block;
  }
  footer span {
    display: block;
    margin-top: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

/* Free-form UI fills the preview; the default renderer chrome is hidden. */
body.has-custom-ui > header,
body.has-custom-ui > main {
  display: none;
}
iframe.custom-ui {
  display: block;
  width: 100%;
  height: 100vh;
  border: 0;
}
iframe.print-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
}
/* /run device shell: full-screen POS with a thin trusted bar. */
body.run { margin: 0; }
.run-login { max-width: 420px; margin: 10vh auto; padding: 0 16px; }
.run-login form, .run-staff { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.run-login [hidden] { display: none; }
.run-login input { width: 100%; font-size: 20px; padding: 10px; }
.run-app { display: flex; flex-direction: column; height: 100vh; }
.run-bar { display: flex; gap: 14px; align-items: center; padding: 8px 14px; border-bottom: 1px solid #ddd; font-size: 14px; }
.run-bar #status { flex: 1; color: #666; }
.run-app #preview-frame { flex: 1; width: 100%; border: 0; }
.devices { margin-top: 24px; border-top: 1px solid #ddd; padding-top: 16px; }
.devices form { display: flex; flex-wrap: wrap; gap: 6px; }
.devices input, .devices select { flex: 1; min-width: 90px; }

/* ---- anypos back office (owo.chat brand: near-black, white o, orange w) ---- */
body.owo { --o-ink: #18181b; --o-accent: #c2410c; --o-hot: #f97316; --o-paper: #fafaf9; --o-line: #e7e5e4; --o-muted: #71717a;
  margin: 0; min-height: 100vh; background: var(--o-paper); color: var(--o-ink); font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif; }
.owo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--o-ink); color: #fff; }
.owo-mark { font-weight: 900; font-size: 26px; letter-spacing: -1px; color: #fff; text-decoration: none; }
.owo-mark b { color: var(--o-hot); font-weight: 900; }
.owo-mark small { font-weight: 600; font-size: 13px; letter-spacing: 0; color: #a1a1aa; margin-left: 6px; }
.owo-me { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.owo-me img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.owo-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.owo-card { background: #fff; border: 1px solid var(--o-line); border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.owo-card h2 { margin: 0 0 10px; font-size: 18px; }
.owo-muted { color: var(--o-muted); font-size: 14px; }
.owo-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 16px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--o-ink); color: #fff; }
.owo-btn.accent { background: var(--o-accent); }
.owo-btn.ghost { background: transparent; color: inherit; border: 1px solid currentColor; padding: 7px 12px; font-weight: 600; }
.owo-btn.line { background: #06c755; font-size: 17px; padding: 14px 22px; }
.owo-shop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--o-line); flex-wrap: wrap; }
.owo-shop:first-of-type { border-top: 0; }
.owo-shop strong { font-size: 16px; }
.owo-code { font-family: ui-monospace, monospace; background: #f4f4f5; border-radius: 6px; padding: 1px 6px; }
.owo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.owo-row input { flex: 1; min-width: 160px; font: inherit; padding: 10px 12px; border: 1px solid var(--o-line); border-radius: 12px; }
.owo-hero { text-align: center; padding: 64px 16px; }
.owo-hero .owo-mark { color: var(--o-ink); font-size: 64px; }
.owo-hero h1 { font-size: 26px; margin: 12px 0 8px; }
.owo-hero p { color: var(--o-muted); margin: 0 auto 28px; max-width: 460px; }
.owo-error { color: #b91c1c; font-size: 14px; min-height: 1em; }
.owo-back { color: inherit; font-weight: 600; text-decoration: none; margin-right: 12px; }
