:root {
  color-scheme: light;
  --bg: #f3f3f0;
  --surface: #ffffff;
  --ink: #141414;
  --muted: #707070;
  --line: #e0e0db;
  --accent: #2450e6;
  --accent-ink: #ffffff;
  --ok: #1f9d55;
  --warn: #c77700;
  --err: #d13c3c;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
h1, h2 { margin: 0; }

button {
  font: inherit;
  min-height: 44px;
  padding: 0.6em 1.1em;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.conn { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #b5b5b0; flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--surface); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; background: #ecece8; color: var(--muted); white-space: nowrap; }
.badge.printed { background: #e3f4ea; color: var(--ok); }
.badge.sent { background: #e6ecfd; color: var(--accent); }
.badge.pending { background: #fdf1de; color: var(--warn); }
.badge.failed { background: #fbe5e5; color: var(--err); }

/* 알림 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 12px;
  background: #222;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--err); }
.toast.ok { background: var(--ok); }

/* 접속 코드 입력 */
.code-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 20, 20, 0.45);
  z-index: 100;
}
.code-box {
  width: min(400px, 100%);
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.code-box h2 { font-size: 1.3rem; margin-bottom: 6px; }
.code-box p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.code-box input {
  width: 100%;
  font: inherit;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-transform: uppercase;
}
.code-box .code-err { min-height: 1.5em; margin: 8px 0 12px; color: var(--err); }
.code-box button { width: 100%; }
