/* =====================================================================
   staff/staff.css — Cutescape Workshop staff dashboard
   Palette and display fonts follow the main Cutescape Studio site.
   ===================================================================== */

@font-face {
  font-family: "CutescapeDisplay";
  src: url("/assets/fonts/18jindaEclairBold.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "CutescapeAccent";
  src: url("/assets/fonts/JindaBiscuitPieBold.ttf") format("truetype");
  font-display: swap;
}

:root {
  --cream: #fdf6e6;
  --cream-deep: #f5e8c8;
  --sage: #cddcbd;
  --sage-soft: #eaf3e1;
  --sage-strong: #9bb886;
  --sage-deep: #55703f;
  --sage-ink: #3f5530;
  --yellow: #f2dd9e;
  --yellow-deep: #b6883a;
  --amber-soft: #fff2d1;
  --amber: #e7b64a;
  --amber-ink: #7a5212;
  --blue-soft: #e8f1f5;
  --blue-muted: #9cbccb;
  --blue-ink: #3e6475;
  --coral-soft: #fbe6de;
  --coral: #d67a5d;
  --coral-ink: #8b3a23;
  --ink: #3a2f28;
  --ink-soft: #7a6b5e;
  --ink-faint: #b3a697;
  --line: #eadfca;
  --paper: #ffffff;

  --font-display: "CutescapeDisplay", "Leelawadee UI", Tahoma, sans-serif;
  --font-accent: "CutescapeAccent", "Leelawadee UI", Tahoma, sans-serif;
  --font-body: "Leelawadee UI", "Noto Sans Thai", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-digits: "Segoe UI", "Noto Sans", "Leelawadee UI", Arial, sans-serif;

  --radius-card: 26px;
  --radius-btn: 18px;
  --shadow-card: 0 8px 0 rgba(155, 184, 134, 0.22), 0 18px 36px rgba(58, 47, 40, 0.1);

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, #fffaf0 0, transparent 42%),
    radial-gradient(circle at 105% 18%, rgba(205, 220, 189, 0.5) 0, transparent 34%),
    var(--cream);
}

button {
  font: inherit;
  color: inherit;
}

p {
  margin: 0;
}

.ws-app {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 36px) 110px;
}

.ws-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.ws-digits {
  font-family: var(--font-digits);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ header */
.ws-top {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px 32px;
  padding: 18px 24px;
  background: var(--paper);
  border: 3px solid var(--sage-strong);
  border-radius: 30px;
  box-shadow: var(--shadow-card);
}

.ws-top::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 34px;
  width: 84px;
  height: 22px;
  background: var(--yellow);
  opacity: 0.9;
  transform: rotate(-4deg);
  border-radius: 4px;
  box-shadow: 0 3px 5px rgba(58, 47, 40, 0.16);
}

.ws-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ws-logo {
  height: 50px;
  width: auto;
  display: block;
}

.ws-brand-name {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.05;
  color: var(--sage-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-brand-sub {
  margin-top: 2px;
  font-family: var(--font-accent);
  font-size: 18px;
  color: var(--ink-soft);
}

.ws-demo-badge {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: var(--amber-ink);
  background: var(--yellow);
  border-radius: 999px;
  padding: 2px 8px;
}

.ws-today {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
}

.ws-date {
  width: 100%;
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
}

.ws-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.ws-stat {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 180px;
  padding: 10px 20px;
  border-radius: 20px;
  background: var(--cream);
}

.ws-stat-label {
  font-size: 15px;
  color: var(--ink-soft);
}

.ws-stat-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-accent);
  font-size: 19px;
  color: var(--ink-soft);
}

.ws-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.ws-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cream);
  font-size: 15px;
  color: var(--ink-soft);
  transition: opacity 0.2s;
}

.ws-chip b {
  font-family: var(--font-digits);
  color: var(--ink);
}

.ws-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.ws-chip.is-running .ws-dot { background: var(--sage-deep); }
.ws-chip.is-paused .ws-dot { background: var(--amber); }
.ws-chip.is-ended .ws-dot { background: var(--sage-strong); }
.ws-chip.is-paused:not([data-zero="true"]) { background: var(--amber-soft); color: var(--amber-ink); }
.ws-chip[data-zero="true"] { opacity: 0.55; }

.ws-stat-value strong {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 42px;
  line-height: 1;
  color: var(--ink);
}

.ws-new {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 14px 28px 14px 16px;
  border: 0;
  border-radius: 24px;
  background: var(--sage-deep);
  color: #fff;
  font-family: var(--font-accent);
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--sage-ink);
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.15s;
}

.ws-new:hover { background: #4b6538; }
.ws-new:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sage-ink); }

.ws-plus {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-family: var(--font-digits);
  font-size: 30px;
  line-height: 1;
}

/* ------------------------------------------------------------------ sections */
.ws-section {
  margin-top: 32px;
}

.ws-section-head {
  margin: 0 6px 14px;
}

.ws-section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 27px;
}

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
  align-items: start;
}

.ws-empty {
  padding: 34px 24px;
  text-align: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 3px dashed var(--sage);
  border-radius: var(--radius-card);
}

.ws-empty strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 24px;
  color: var(--ink);
}

/* ------------------------------------------------------------------ session card */
.ws-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 20px 18px;
  background: var(--paper);
  border: 3px solid var(--sage);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s, background-color 0.25s;
}

.ws-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-number {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
}

.ws-workshop {
  font-family: var(--font-accent);
  font-size: 17px;
  color: var(--ink-soft);
}

.ws-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  background: var(--blue-soft);
  color: var(--blue-ink);
  white-space: nowrap;
}

.ws-status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.ws-start {
  margin-top: -6px;
  font-size: 14px;
  color: var(--ink-soft);
}

.ws-day-note {
  font-size: 14px;
  font-weight: 700;
  color: var(--amber-ink);
}

.ws-meter {
  display: grid;
  gap: 2px;
  padding: 14px 16px 12px;
  border-radius: 20px;
  background: var(--cream);
  transition: background-color 0.25s;
}

.ws-money {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ws-money-value {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 66px;
  line-height: 1;
  color: var(--ink);
  transform-origin: left bottom;
}

.ws-money-unit {
  font-family: var(--font-accent);
  font-size: 24px;
  color: var(--ink-soft);
}

.ws-time {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-digits);
  font-variant-numeric: tabular-nums;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.ws-time .ws-icon {
  width: 21px;
  height: 21px;
  color: var(--ink-soft);
}

.ws-money-note {
  font-size: 14px;
  color: var(--ink-soft);
}

.ws-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--coral-soft);
  color: var(--coral-ink);
  font-weight: 700;
}

.ws-warning .ws-icon { color: var(--coral); }

.ws-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ws-actions .ws-btn:only-child,
.ws-card[data-status="created"] .ws-btn[data-action="start"] {
  grid-column: 1 / -1;
}

/* After Start, QR stays available as a quieter full-width button */
.ws-card:not([data-status="created"]) .ws-btn[data-action="qr"] {
  grid-column: 1 / -1;
  min-height: 44px;
  font-size: 17px;
}

/* status: waiting */
.ws-card[data-status="created"] { border-color: var(--blue-muted); }
.ws-card[data-status="created"] .ws-money-value { color: var(--ink-faint); }

/* status: running */
.ws-card[data-status="running"] { border-color: var(--sage-strong); }
.ws-card[data-status="running"] .ws-status { background: var(--sage-soft); color: var(--sage-deep); }
.ws-card[data-status="running"] .ws-status::before { animation: ws-breathe 2.4s ease-in-out infinite; }
.ws-card[data-status="running"] .ws-meter { background: #f2f8ec; }

/* status: paused — obvious without flashing */
.ws-card[data-status="paused"] {
  border-color: var(--amber);
  background: #fffaf0;
  padding-top: 30px;
}

.ws-card[data-status="paused"]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 12px;
  border-radius: 23px 23px 0 0;
  background: repeating-linear-gradient(135deg, var(--amber) 0 10px, var(--yellow) 10px 20px);
}

.ws-card[data-status="paused"] .ws-status { background: var(--amber); color: #fff; }
.ws-card[data-status="paused"] .ws-meter { background: var(--amber-soft); }
.ws-card[data-status="paused"] .ws-money-value,
.ws-card[data-status="paused"] .ws-time { color: var(--amber-ink); }
.ws-card[data-status="paused"] .ws-money-note { color: var(--amber-ink); font-weight: 700; }

/* attention */
.ws-card[data-warning]:not([data-warning=""]) { border-color: var(--coral); }
.ws-card[data-warning]:not([data-warning=""]) .ws-status { background: var(--coral-soft); color: var(--coral-ink); }
.ws-card[data-warning="finalize-incomplete"] .ws-money-value { color: var(--ink-soft); }

.ws-money-value.is-bump { animation: ws-bump 0.6s ease-out; }
.ws-card.is-new { animation: ws-arrive 1s ease-out; }

@keyframes ws-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); color: var(--sage-deep); }
  100% { transform: scale(1); }
}

@keyframes ws-breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

@keyframes ws-arrive {
  0% { transform: translateY(10px); box-shadow: 0 0 0 7px rgba(155, 184, 134, 0.55), var(--shadow-card); }
  100% { transform: none; }
}

/* ------------------------------------------------------------------ buttons */
.ws-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: var(--radius-btn);
  font-family: var(--font-accent);
  font-size: 21px;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.15s, box-shadow 0.1s;
}

.ws-btn:active { transform: translateY(2px); }

.ws-btn:focus-visible,
.ws-new:focus-visible,
.ws-demo-toggle:focus-visible,
.ws-seg button:focus-visible {
  outline: 3px solid var(--blue-muted);
  outline-offset: 3px;
}

.ws-btn--go { background: var(--sage-deep); color: #fff; box-shadow: 0 4px 0 var(--sage-ink); }
.ws-btn--go:hover { background: #4b6538; }
.ws-btn--go:active { box-shadow: 0 1px 0 var(--sage-ink); }
.ws-btn--pause { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber); }
.ws-btn--pause:hover { background: #ffe9b5; }
.ws-btn--end { background: #fff; color: var(--coral-ink); border-color: var(--coral); }
.ws-btn--end:hover { background: var(--coral-soft); }
.ws-btn--soft { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue-muted); }
.ws-btn--soft:hover { background: #d9e9f0; }
.ws-btn--quiet { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.ws-btn--quiet:hover { background: var(--cream); }
.ws-btn--warn { background: var(--coral); color: #fff; box-shadow: 0 4px 0 var(--coral-ink); }

/* ------------------------------------------------------------------ today's table */
.ws-table-panel {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid var(--line);
  border-radius: 22px;
}

.ws-table-scroll {
  overflow-x: auto;
}

/* Equal fixed columns, everything centred, so every column lines up. */
.ws-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  table-layout: fixed;
}

.ws-table th,
.ws-table td {
  padding: 12px 8px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.ws-table th {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
}

.ws-table td {
  font-size: 18px;
  border-top: 1px dashed var(--line);
}

.ws-table tbody tr:first-child td {
  border-top: 0;
}

.ws-table .ws-digits {
  font-variant-numeric: tabular-nums;
}

.ws-cell-number {
  font-family: var(--font-display);
  font-size: 23px !important;
}

.ws-cell-status {
  font-weight: 700;
  color: var(--ink-soft);
}

.ws-cell-money {
  font-family: var(--font-accent);
  color: var(--ink-soft);
}

.ws-cell-money span {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--ink);
}

.ws-row[data-status="running"] .ws-cell-status { color: var(--sage-deep); }
.ws-row[data-status="paused"] .ws-cell-status { color: var(--amber-ink); }
.ws-row[data-warning="true"] .ws-cell-status { color: var(--coral-ink); }

.ws-empty-small {
  padding: 14px;
  text-align: center;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ dialogs */
.ws-dialog {
  width: 100%;
  max-width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(58, 47, 40, 0.3);
}

.ws-dialog::backdrop { background: rgba(58, 47, 40, 0.4); }

.ws-dialog-body {
  display: grid;
  gap: 14px;
  padding: 26px 26px 22px;
}

.ws-dialog h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 29px;
}

.ws-dialog p { color: var(--ink-soft); }

.ws-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.ws-dialog-actions .ws-btn { min-width: 132px; }
.ws-dialog-actions--center { justify-content: center; }

.ws-confirm-meter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--cream);
}

.ws-mini-label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
}

.ws-confirm-meter strong {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 30px;
}

.ws-confirm-meter strong.ws-digits {
  font-family: var(--font-digits);
  font-weight: 600;
  font-size: 26px;
}

.ws-confirm-meter small { font-family: var(--font-accent); font-size: 18px; color: var(--ink-soft); }

.ws-result .ws-dialog-body {
  justify-items: center;
  text-align: center;
  padding-top: 30px;
}

.ws-result-number {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--ink) !important;
}

.ws-result-status {
  padding: 4px 16px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--sage-soft);
  color: var(--sage-deep) !important;
}

.ws-result-money {
  font-family: var(--font-display);
  font-size: 92px;
  line-height: 1;
  color: var(--ink) !important;
}

.ws-result-money small {
  margin-left: 10px;
  font-family: var(--font-accent);
  font-size: 30px;
  color: var(--ink-soft);
}

.ws-result-time { font-size: 18px; }
.ws-result-time strong { font-size: 22px; color: var(--ink); }

/* customer QR */
.ws-qr { max-width: min(780px, calc(100vw - 32px)); }

.ws-qr-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 28px;
  padding: 28px;
}

/* The customer sticker as it is mounted on the QR holder: portrait, 75 mm wide
   × 100 mm tall, drawn at real size so the preview matches the paper. Pure
   black on white for the monochrome thermal printer. Print turns it 90° onto
   the 100 × 75 mm media (see "sticker print" below). */
.ws-slip {
  --slip-qr: 46mm; /* includes the QR's own 4-module white quiet zone */
  flex: none;
  width: 75mm;
  height: 100mm;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  justify-items: center;
  align-items: center;
  gap: 1mm;
  padding: 3mm 4mm 3mm;
  overflow: hidden;
  text-align: center;
  color: #000;
  background: #fff;
  font-family: var(--font-body);
  box-shadow: 0 0 0 1px #d9d2c4, 0 12px 26px rgba(0, 0, 0, 0.12);
}

.ws-dialog .ws-slip p { margin: 0; color: #000; }
.ws-slip-logo { display: block; width: 32mm; filter: brightness(0); } /* pastel artwork → solid black */
.ws-slip-title { font-size: 3.9mm; font-weight: 700; line-height: 1.15; }
.ws-slip-number {
  font-family: var(--font-digits);
  font-size: 14mm;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.ws-slip-hint { font-size: 3.9mm; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.ws-slip-qr { width: var(--slip-qr); height: var(--slip-qr); }
.ws-slip-qr svg { display: block; width: 100%; height: 100%; }
/* Counter instruction: readable, but quieter than the number and the QR. */
.ws-slip-counter { margin-top: 0.6mm; font-size: 3mm; font-weight: 600; line-height: 1.25; }
.ws-slip-counter span { display: inline-block; } /* break between Thai phrases, never inside a word */

.ws-qr-side { display: grid; gap: 14px; align-content: center; }

.ws-note {
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--cream);
}

/* ------------------------------------------------------------------ toast */
.ws-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 12px 30px rgba(58, 47, 40, 0.3);
}

/* ------------------------------------------------------------------ demo tools */
.ws-demo {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  display: grid;
  justify-items: start;
  gap: 8px;
}

.ws-demo-toggle {
  padding: 8px 14px;
  border: 2px dashed var(--yellow-deep);
  border-radius: 999px;
  background: var(--yellow);
  font-family: var(--font-accent);
  font-size: 15px;
  cursor: pointer;
}

.ws-demo-panel {
  width: min(300px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 2px dashed var(--yellow-deep);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(58, 47, 40, 0.18);
}

.ws-demo-title { font-family: var(--font-accent); font-size: 18px; }
.ws-demo-text { font-size: 13px; color: var(--ink-soft); }
.ws-demo-label { font-size: 14px; font-weight: 700; }

.ws-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ws-seg button {
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  font-weight: 700;
  cursor: pointer;
}

.ws-seg button[aria-pressed="true"] {
  background: var(--sage-deep);
  border-color: var(--sage-deep);
  color: #fff;
}

.ws-demo-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
}

.ws-demo-check input { width: 20px; height: 20px; margin: 0; flex: none; }
.ws-demo-reset { min-height: 44px; font-size: 16px; }

/* ------------------------------------------------------------------ staff PIN gate */
.ws-gate {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.ws-gate .ws-logo {
  height: 54px;
}

.ws-gate-card {
  display: none;
  gap: 14px;
  justify-items: center;
  width: min(400px, 100%);
  padding: 26px 24px;
  background: var(--paper);
  border: 3px solid var(--sage-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.ws-gate[data-state="locked"] .ws-gate-card[data-gate="locked"],
.ws-gate[data-state="unset"] .ws-gate-card[data-gate="unset"],
.ws-gate[data-state="connecting"] .ws-gate-card[data-gate="connecting"],
.ws-gate[data-state="unregistered"] .ws-gate-card[data-gate="unregistered"],
.ws-gate[data-state="error"] .ws-gate-card[data-gate="error"] {
  display: grid;
}

.ws-gate-card .ws-device-code {
  max-width: 100%;
  padding: 10px 12px;
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 17px;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
  user-select: all;
}

.ws-gate-hint {
  margin: -6px 0 0;
  font-size: 14px;
}

.ws-gate-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 26px;
}

.ws-gate-card p {
  color: var(--ink-soft);
}

.ws-gate-card code {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
}

.ws-gate-card .ws-btn {
  min-width: 220px;
}

.ws-pin-input {
  width: 190px;
  padding: 12px 10px;
  border: 2px solid var(--sage);
  border-radius: 16px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-digits);
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: 0.35em;
  text-align: center;
}

.ws-pin-input:focus-visible {
  outline: 3px solid var(--blue-muted);
  outline-offset: 3px;
}

.ws-gate-note {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--coral-soft);
  color: var(--coral-ink) !important;
  font-size: 15px;
}

.ws-lock-btn {
  margin-top: 6px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}

.ws-lock-btn:hover {
  background: var(--cream);
}

.ws-studio-link {
  display: inline-block;
  margin-right: 4px;
  text-decoration: none;
}

/* ------------------------------------------------------------------ not available */
.ws-blocked {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .ws-top { grid-template-columns: 1fr auto; }
  .ws-today { grid-column: 1 / -1; order: 3; justify-content: flex-start; }
  .ws-date { text-align: left; }
  .ws-summary { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .ws-top { grid-template-columns: 1fr; padding: 16px; }
  .ws-new { width: 100%; justify-content: center; }
  .ws-logo { height: 40px; }
  .ws-stat { flex: 1; min-width: 0; }
  .ws-qr-layout { grid-template-columns: 1fr; justify-items: center; padding: 22px; }
  .ws-result-money { font-size: 72px; }
}

@media (max-width: 460px) {
  .ws-slip { zoom: 0.8; } /* preview only; print keeps the real size */
}

/* ------------------------------------------------------------------ sticker print
   Only the customer sticker prints, at exactly 100 × 75 mm with no page margin
   (so the browser has no room for its own headers/footers). Everything else on
   the page, the dialog chrome and the backdrop are removed from the printout.
   The portrait 75 × 100 mm artwork is turned 90° clockwise to fill the
   landscape page, so the top of the design lands on the page's right edge.
   To flip which edge is the top, swap the rotation (see .ws-slip below). */
@page {
  size: 100mm 75mm;
  margin: 0;
}

@media print {
  html, body {
    width: 100mm;
    height: 75mm;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #fff !important;
  }

  body > :not(#wsApp),
  #wsApp > :not(#wsQr),
  .ws-qr-side,
  .ws-qr::backdrop {
    display: none !important;
  }

  .ws-app { width: auto; margin: 0; padding: 0; }

  .ws-qr,
  .ws-qr[open] {
    position: static;
    inset: auto;
    transform: none;
    width: 100mm;
    max-width: none;
    height: 75mm;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }

  .ws-qr-layout {
    position: relative;
    display: block;
    width: 100mm;
    height: 75mm;
    padding: 0;
    overflow: hidden;
  }

  .ws-slip {
    position: absolute;
    top: 0;
    left: 0;
    zoom: 1;
    transform-origin: 0 0;
    transform: translateX(100mm) rotate(90deg);
    /* other way round: transform: translateY(75mm) rotate(-90deg); */
    box-shadow: none;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
