/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --cm-pos:        #428bca;
  --cm-pos-hover:  #3071a9;
  --cm-pos-active: #155f3f;
  --cm-pos-soft:   #e7f4ec;
  --cm-pos-ink:    #155f3f;
  --qs-ink:           #155f3f;
  --qs-warn-bg:       #fff8e1;
  --qs-warn-text:     #7a5b00;
  --qs-warn-border:   #e9ecef;
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: var(--bs-tertiary-bg, #f8f9fa);
  -webkit-font-smoothing: antialiased;
}

/* ── App shell — 480 px centred column ─────────────────────── */
.app-shell {
  max-width: 480px;
  margin-inline: auto;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Mono ───────────────────────────────────────────────────── */
.mono {
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", "Courier New", monospace;
  font-feature-settings: "tnum", "zero";
}

/* ── Brand mark (34×34 rounded square with Q) ───────────────── */
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background-color: var(--cm-pos);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* ── Icon swatch (36×36) ────────────────────────────────────── */
.icon-swatch {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1rem;
}

/* ── "Kiosk paired" badge ───────────────────────────────────── */
.badge-kiosk-paired {
  background-color: var(--cm-pos-soft);
  color: var(--cm-pos-ink);
  border: 1px solid #b7ddc9;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Primary accent button ──────────────────────────────────── */
.btn-accent {
  background-color: var(--cm-pos);
  border-color: var(--cm-pos);
  color: #fff;
  font-weight: 600;
}
.btn-accent:hover  { background-color: var(--cm-pos-hover);  border-color: var(--cm-pos-hover);  color: #fff; }
.btn-accent:active { background-color: var(--cm-pos-active); border-color: var(--cm-pos-active); color: #fff; }
.btn-accent:focus-visible {
  background-color: var(--cm-pos-hover);
  border-color: var(--cm-pos-hover);
  color: #fff;
  box-shadow: 0 0 0 0.25rem rgba(31, 138, 91, .35);
}

/* ── 48 px tap-target floor ─────────────────────────────────── */
.btn                    { min-height: 48px; }
.form-control           { min-height: 48px; font-size: 1rem; }
.input-group-text       { min-height: 48px; }
.list-group-item-action { min-height: 48px; }

/* ── Segmented control (PREP / CLOSE tabs) ──────────────────── */
.segmented-control {
  display: flex;
  background-color: #f1f3f5;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  border: 1px solid #dee2e6;
}
.segmented-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #6c757d;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  text-decoration: none;
}
.segmented-btn.active {
  background-color: #fff;
  color: var(--qs-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 1px #dee2e6;
}
.segmented-btn:hover:not(.active) { background-color: rgba(255,255,255,.5); }

/* ── Ticket block (left dark panel on card) ─────────────────── */
.ticket-block {
  min-width: 78px;
  width: 78px;
  background-color: var(--qs-ink);
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  flex-shrink: 0;
}
.ticket-block.closed {
  background-color: #f1f3f5;
  color: var(--qs-ink);
}
.ticket-block .block-label {
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
  opacity: .75;
  text-transform: uppercase;
}
.ticket-block .block-no {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-top: 2px;
}

/* ── Ticket card ────────────────────────────────────────────── */
.ticket-card {
  display: block;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
  text-decoration: none;
  color: inherit;
}
.ticket-card:hover  { border-color: #adb5bd; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ticket-card.overdue { border-color: var(--qs-warn-border) !important; }

/* ── Customer note pill ─────────────────────────────────────── */
.note-pill {
  display: inline-block;
  background-color: var(--qs-warn-bg);
  color: var(--qs-warn-text);
  border: 1px solid var(--qs-warn-border);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  margin-top: 8px;
}

/* ── Channel badge ──────────────────────────────────────────── */
.channel-badge {
  display: inline-block;
  background-color: #f1f3f5;
  color: #495057;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid #dee2e6;
  font-weight: 500;
}

/* ── Status chip ────────────────────────────────────────────── */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid;
  white-space: nowrap;
}
.status-chip.success { background-color: var(--cm-pos-soft); color: var(--cm-pos-ink); border-color: #b7ddc9; }
.status-chip.danger  { background-color: #fff0f0; color: #9b1c1c; border-color: #fca5a5; }
.status-chip .chip-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ── Live indicator ─────────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--cm-pos);
  animation: qs-pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes qs-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Sticky bottom CTA strip ────────────────────────────────── */
.sticky-cta {
  position: sticky;
  bottom: 0;
  padding: 12px 20px 20px;
  background: linear-gradient(to bottom, transparent, #fff 28%);
}

/* ── Top navbar (dashboard) ─────────────────────────────────── */
.qs-navbar {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f3f5;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ── Shop selector button in navbar ────────────────────────── */
.shop-selector-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.shop-selector-btn:hover { background: #f1f3f5; }

/* ── Bottom sheet (offcanvas) ───────────────────────────────── */
.offcanvas-bottom.qs-sheet {
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  max-height: 85vh;
}
.qs-sheet .sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: #dee2e6;
  margin: 10px auto 4px;
}

/* ── Page loading overlay ───────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  transition: opacity 0.2s ease;
}
.page-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}
.loader-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--cm-pos-soft, #e8f2fb);
  border-top-color: var(--cm-pos, #428bca);
  border-radius: 50%;
  animation: qs-spin 0.65s linear infinite;
}
.loader-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
}
@keyframes qs-spin {
  to { transform: rotate(360deg); }
}

/* ── Detail grid ────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #dee2e6;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 18px;
}
.detail-grid-cell {
  background: #fff;
  padding: 12px 14px;
}
.detail-grid-cell .cell-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6c757d;
}
.detail-grid-cell .cell-value {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 4px;
}

/* ── Shop list item ─────────────────────────────────────────── */
.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #e9ecef;
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
  margin-bottom: 8px;
  min-height: 48px;
}
.shop-item:hover:not(.selected) { border-color: #adb5bd; }
.shop-item.selected {
  border-color: var(--cm-pos);
  background: var(--cm-pos-soft);
  box-shadow: 0 0 0 3px rgba(31, 138, 91, .15);
}
.shop-item .shop-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  background: #fff;
  flex-shrink: 0;
  transition: border .12s;
}
.shop-item.selected .shop-radio {
  border: 6px solid var(--cm-pos);
}
.shop-item .shop-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f3f5;
  color: #6c757d;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  transition: background .12s, color .12s;
}
.shop-item.selected .shop-icon {
  background: var(--cm-pos);
  color: #fff;
}

/* ── Scrollable list area ───────────────────────────────────── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #dee2e6 transparent;
}
.scroll-area::-webkit-scrollbar { width: 4px; }
.scroll-area::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

/* ── FCM live-dot state variants ────────────────────────────── */
/* default (no modifier) = blue/accent = connecting             */
.live-dot.connected { background-color: #198754; animation: qs-pulse 2s infinite; }
.live-dot.warn      { background-color: #fd7e14; animation: qs-pulse 3s infinite; }
.live-dot.error     { background-color: #dc3545; animation: none; opacity: .7; }

/* ── FCM toast ───────────────────────────────────────────────── */
#fcmToastContainer .toast {
  min-width: 240px;
  border-radius: 12px;
  background: #fff;
}

/* ── Login card wrapper ─────────────────────────────────────── */
.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}
