:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #15181d;
  --muted: #5c6470;
  --border: #d9dde3;
  --primary: #1f5fd1;
  --primary-text: #ffffff;
  --accent: #b54708;
  --accent-bg: #fff4e5;
  --success: #1a7f37;
  --success-bg: #e8f6ec;
  --warning: #9a6700;
  --warning-bg: #fff8db;
  --danger: #c0262d;
  --danger-bg: #fdecec;
  --highlight: #fff1c2;
  --radius: 10px;
  --gap: 12px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body[data-theme='dark'] {
  --bg: #0d1117;
  --surface: #161b22;
  --text: #f0f3f6;
  --muted: #9aa4b1;
  --border: #30363d;
  --primary: #4c8dff;
  --accent: #ffb547;
  --accent-bg: #3a2a10;
  --success: #3fb950;
  --success-bg: #11261a;
  --highlight: #4a3a00;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
h1 {
  font-size: 1.6rem;
  margin: 0 0 12px;
}
h2 {
  font-size: 1.3rem;
  margin: 16px 0 8px;
}
h3.title,
h2.title {
  margin: 0 0 8px;
}
a,
.link {
  color: var(--primary);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.row {
  display: flex;
  flex-direction: row;
  gap: var(--gap);
  align-items: center;
}
.row.wrap {
  flex-wrap: wrap;
}
.grid {
  display: grid;
  gap: var(--gap);
}
.grid.min-s {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.grid.min-m {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.grid.min-l {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.grid.min-xl {
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
}
.gap-none {
  gap: 0;
}
.gap-s {
  gap: 6px;
}
.gap-l {
  gap: 20px;
}
.stack.align-center {
  align-items: center;
  text-align: center;
}
.row.align-between {
  justify-content: space-between;
}
.row.align-center {
  justify-content: center;
}
.row.align-end {
  justify-content: flex-end;
}
.card,
section.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.card.narrow {
  max-width: 420px;
  margin: 40px auto;
}
.card.highlight,
tr.highlight {
  background: var(--highlight);
}
.card.highlight {
  border-color: var(--accent);
  animation: pulse 1.2s ease-in-out 3;
}
@keyframes pulse {
  50% {
    transform: scale(1.02);
  }
}
@media (prefers-reduced-motion: reduce) {
  .card.highlight {
    animation: none;
  }
}
.text {
  margin: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.bold {
  font-weight: 700;
}
.mono {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
.align-center {
  text-align: center;
}
.align-end {
  text-align: right;
}
.size-xs {
  font-size: 0.75rem;
}
.size-s {
  font-size: 0.875rem;
}
.size-m {
  font-size: 1rem;
}
.size-l {
  font-size: 1.25rem;
}
.size-xl {
  font-size: 1.6rem;
}
.size-xxl {
  font-size: 2.4rem;
}
.size-huge {
  font-size: clamp(3rem, 9vw, 7rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
}
.tone-muted {
  color: var(--muted);
}
.tone-accent {
  color: var(--accent);
}
.tone-success {
  color: var(--success);
}
.tone-warning {
  color: var(--warning);
}
.tone-danger {
  color: var(--danger);
}
.tone-primary {
  color: var(--primary);
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--border);
  color: var(--text);
  white-space: nowrap;
}
.badge.tone-accent {
  background: var(--accent-bg);
  color: var(--accent);
}
.badge.tone-success {
  background: var(--success-bg);
  color: var(--success);
}
.badge.tone-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge.tone-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.notice.tone-warning {
  background: var(--warning-bg);
  color: var(--text);
  border-color: var(--warning);
}
.notice.tone-danger {
  background: var(--danger-bg);
  color: var(--text);
  border-color: var(--danger);
}
.notice.tone-success {
  background: var(--success-bg);
  color: var(--text);
  border-color: var(--success);
}
.btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover:not(:disabled) {
  border-color: var(--primary);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.tone-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn.tone-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn.tone-danger {
  color: var(--danger);
  border-color: var(--danger);
}
.btn.tone-warning {
  color: var(--warning);
  border-color: var(--warning);
}
.btn.size-s {
  min-height: 32px;
  padding: 4px 10px;
}
.btn.size-l {
  min-height: 52px;
  padding: 10px 20px;
}
.btn.size-xl {
  min-height: 64px;
  padding: 12px 28px;
  font-size: 1.4rem;
  font-weight: 600;
}
.btn.btn-preview {
  border-style: dashed;
}
.btn.issue {
  flex-direction: column;
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  font-weight: 600;
}
.btn.issue.size-huge {
  min-height: 140px;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  border-radius: 16px;
  width: 100%;
}
.issue-sublabel {
  font-size: 0.8em;
  font-weight: 400;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.field-label {
  font-size: 0.875rem;
  color: var(--muted);
}
.field-checkbox .field-label {
  color: var(--text);
}
input,
select,
textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 40px;
  max-width: 100%;
}
input[type='checkbox'] {
  min-height: 0;
  width: 20px;
  height: 20px;
}
textarea.code {
  width: 100%;
  font-size: 0.85rem;
  line-height: 1.4;
}
.form {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.form-inline {
  align-items: flex-end;
  margin-bottom: var(--gap);
}
.form-status {
  margin: 0;
  min-height: 1.2em;
}
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.table {
  border-collapse: collapse;
  width: 100%;
}
.table th,
.table td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.table td.align-end,
.table th.align-end {
  text-align: right;
}
.table tr.tone-muted td {
  color: var(--muted);
}
.table .form {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
}
.qr {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.qr svg {
  width: 160px;
  height: 160px;
  background: #fff;
  border-radius: 6px;
}
.qr.size-s svg {
  width: 110px;
  height: 110px;
}
.qr.size-l svg {
  width: min(300px, 70vw);
  height: min(300px, 70vw);
}
.qr figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: var(--muted);
  background: none;
  font: inherit;
  cursor: pointer;
}
.tab.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  font-weight: 600;
}
.banner {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--warning-bg);
  color: var(--text);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: var(--gap);
  font-weight: 600;
}
.script-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: var(--gap);
}
.script-error pre,
.log {
  white-space: pre-wrap;
  font-size: 0.85rem;
  margin: 6px 0 0;
}
.preview-panel {
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: var(--gap);
  background: var(--surface);
}
.preview-panel p {
  margin: 6px 0;
}
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 520px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
}
.toast.tone-danger {
  background: var(--danger);
  color: #fff;
}
.toast.tone-warning {
  background: var(--warning);
  color: #fff;
}
.toast.tone-success {
  background: var(--success);
  color: #fff;
}
.device-chrome {
  position: fixed;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 8px;
  z-index: 30;
  opacity: 0.85;
}
body.device .page,
body.device .screen {
  max-width: none;
  padding: 16px 24px;
}
body.device-display .screen-content .size-huge {
  font-size: clamp(4rem, 10vw, 10rem);
}
body.device-display .section > h2.title {
  font-size: clamp(1.4rem, 3vw, 2.6rem);
}
body.device-kiosk .screen-content {
  max-width: 1100px;
  margin: 0 auto;
}
body.phone .page {
  max-width: 560px;
}
section.section > h2.title {
  font-size: 1.15rem;
}
hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
}
.unit-area {
  margin-top: 8px;
}
@media (max-width: 600px) {
  .page {
    padding: 12px 16px;
  }
  .row:not(.wrap) {
    flex-wrap: wrap;
  }
  .card {
    padding: 12px;
  }
}
.screen-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.text.size-huge {
  white-space: nowrap;
}
body.device-display .card .text.size-huge {
  font-size: clamp(2.5rem, 7vw, 8rem);
}
.card > .btn,
.card > .row > .btn:only-child {
  align-self: flex-start;
}
