/* App-only styles. Uses the price page's color variables, so dark and light mode match. */

/* Staff Tools button: top-left of the header, mirroring the theme toggle */
.app-tools-btn { right: auto; left: 0.9rem; overflow: visible; /* its count badge sits on the corner */ }
@media (min-width: 760px) {
  .app-tools-btn { left: 1.5rem; }
}

body.app-panel-open { overflow: hidden; }

/* Keep [hidden] working on elements whose classes set a display value (e.g. .btn) */
.kms-app [hidden] { display: none !important; }

/* Full-screen Staff Tools panel */
.app-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg-page);
  color: var(--text-main);
  flex-direction: column;
}
.app-panel.active { display: flex; }

.app-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--kms-red);
  border-bottom: 5px solid var(--kms-black);
  color: var(--kms-white);
}
.app-panel-title { font-size: 1.15rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; }
.app-panel-sub { font-size: 0.7rem; font-weight: 700; opacity: 0.85; letter-spacing: 0.08em; text-transform: uppercase; }

.app-tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid var(--border-color);
}
.app-tab {
  flex: 1 1 0;
  min-width: 0;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.74rem;
  padding: 0.5rem 0.2rem;
  border-radius: 999px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: visible; /* the count bubble sits on its corner */
}
.app-tab.active { background: var(--kms-red); border-color: var(--kms-red); color: var(--kms-white); }
/* Six tabs on a phone: each as wide as its name, a little smaller */
@media (max-width: 480px) {
  .app-tabs { gap: 0.2rem; padding: 0.6rem 0.45rem; }
  .app-tab { flex: 1 1 auto; font-size: 0.68rem; padding: 0.45rem 0.3rem; }
}

/* Count bubbles on tabs, switcher options and page buttons */
.app-count-bubble {
  display: inline-block;
  min-width: 1.1rem;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--kms-black);
  color: var(--kms-white);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.25rem;
  text-align: center;
  vertical-align: middle;
}
.app-tab.active .app-count-bubble, .app-btn-primary .app-count-bubble { background: var(--kms-white); color: var(--kms-red); }
/* On the main tabs the count sits on the corner, so all the tabs still fit a phone */
.app-tab .app-count-bubble { position: absolute; top: -0.5rem; right: -0.2rem; margin: 0; border: 2px solid var(--bg-page); }

/* A tab's switcher, and a page's back arrow + title */
.app-subnav { max-width: 820px; margin: 0 auto 0.9rem auto; }
.app-page-nav { max-width: 820px; margin: 0 auto 0.9rem auto; display: flex; align-items: center; gap: 0.75rem; }
.app-back-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
}
.app-page-title { margin: 0; font-size: 1.1rem; font-weight: 900; }

/* Buttons that open pages (e.g. Inventory → Add Cards) */
.app-page-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 0.5rem; margin-bottom: 0.9rem; }
.app-page-links .app-btn { padding: 0.65rem 0.4rem; font-size: 0.8rem; }

.app-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.app-feature { max-width: 820px; margin: 0 auto; }

.app-hint { font-size: 0.8rem; color: var(--text-sub); margin: 0 0 0.75rem 0; line-height: 1.4; }
.app-stats { font-size: 0.9rem; margin-bottom: 0.75rem; color: var(--text-sub); }
.app-stats strong { color: var(--text-main); }

.app-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
}
.app-input:focus { outline: none; border-color: var(--kms-red); }

.app-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.app-count { flex: 1; font-size: 0.8rem; font-weight: 600; color: var(--text-sub); }

.app-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
}
.app-btn:disabled { opacity: 0.45; cursor: default; }
.app-btn-danger { color: var(--kms-red) !important; border-color: var(--kms-red) !important; }

.app-list { display: flex; flex-direction: column; }
.app-list-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.25rem;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.app-list-row.selected { background: rgba(227, 21, 21, 0.1); }
.app-row-main { flex: 1; min-width: 0; }
.app-row-title { font-weight: 800; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-row-meta { font-size: 0.75rem; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-row-price { font-weight: 900; font-size: 0.95rem; color: var(--kms-red); }
.app-check { width: 20px; height: 20px; accent-color: var(--kms-red); flex: 0 0 auto; }

.app-thumb { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 6px; overflow: hidden; background: #fff; }
.app-thumb canvas { width: 48px; height: 48px; display: block; }

.app-icon-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin-left: 0.3rem;
  border-radius: 50%;
  border: 2px solid var(--kms-red);
  background: transparent;
  color: var(--kms-red);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

/* Dialogs on top of the panel */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.app-modal {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 3px solid var(--border-color);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
}
.app-modal-body { overflow-y: auto; padding: 1rem 1.25rem 1.25rem 1.25rem; }
.app-modal-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }

.app-label-preview { display: flex; justify-content: center; }

/* Inventory card window */
.app-tappable { cursor: pointer; }
.app-card-window { display: flex; gap: 0.9rem; align-items: flex-start; margin-bottom: 0.9rem; }
.app-card-image-box { flex: 0 0 42%; max-width: 200px; }
.app-card-image { width: 100%; border-radius: 10px; display: block; }
.app-card-facts { flex: 1; min-width: 0; }
.app-card-price { font-size: 1.6rem; font-weight: 900; margin: 0.35rem 0; }
.app-consign-badge { display: inline-block; margin-left: 0.35rem; background: var(--surface); color: var(--text-main); border: 1px solid var(--border-color); text-transform: none; letter-spacing: 0; }
.app-label-preview canvas {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 10px;
  border: 2px solid var(--border-color);
}

.app-field-label { color: var(--text-sub); margin: 1rem 0 0.4rem 0; }
.app-qty {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 6.5rem;
  z-index: 200;
  transform: translate(-50%, 20px);
  opacity: 0;
  max-width: calc(100% - 2rem);
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  background: var(--kms-black);
  color: var(--kms-white);
  border: 2px solid var(--kms-red);
  font-weight: 700;
  font-size: 0.85rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Labels printing in the background (print dialog closed): tap the text to see the dialog again */
.app-print-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 170;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem 0.45rem 0.9rem;
  border-radius: 14px;
  background: var(--kms-black);
  color: var(--kms-white);
  border: 2px solid var(--kms-red);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.app-print-bar-error { border-color: #f0a020; }
.app-print-bar-text {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  padding: 0.3rem 0;
}
.app-print-bar .close-btn { color: var(--kms-white); }
.app-print-bar .app-btn { flex: none; background: var(--kms-white); color: var(--kms-black); border-color: var(--kms-white); }

/* Cards, form rows and controls used by the printing and design tabs */
.app-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.app-card-title { font-weight: 900; font-size: 1rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.app-card .btn { margin-top: 0.4rem; }
.app-btn-primary { background: var(--kms-red) !important; border-color: var(--kms-red) !important; color: var(--kms-white) !important; }
.app-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--kms-white);
  background: var(--kms-red);
  border-radius: 999px;
  padding: 2px 8px;
}
.app-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-sub); display: inline-block; }
.app-dot.on { background: #22c55e; }

.app-num { display: block; font-size: 0.72rem; font-weight: 700; color: var(--text-sub); }
.app-num .app-input { margin-top: 0.25rem; }
.app-grid-2, .app-grid-3, .app-grid-4 { display: grid; gap: 0 0.6rem; }
.app-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.app-grid-2 > *, .app-grid-2 .app-input { min-width: 0; }
input[type="date"].app-input { font-size: 0.85rem; padding-left: 0.6rem; padding-right: 0.4rem; }
.app-grid-3 { grid-template-columns: 1.4fr 1fr 1fr; }
.app-grid-4 { grid-template-columns: repeat(4, 1fr); }
.app-check-label, .app-radio { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; margin: 0.35rem 0; }
.app-check-label input, .app-radio input { width: 18px; height: 18px; accent-color: var(--kms-red); }
.app-range { display: grid; grid-template-columns: 5.5rem 1fr 2rem; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 700; margin: 0.4rem 0; }
.app-range input { accent-color: var(--kms-red); }
.app-range strong { text-align: right; }
.app-details { margin-top: 0.75rem; font-size: 0.85rem; }
.app-details summary { font-weight: 800; cursor: pointer; }
.app-title-input { font-weight: 800; font-size: 1.05rem; }

.app-progress { position: relative; height: 28px; border-radius: 10px; overflow: hidden; background: var(--surface); border: 2px solid var(--border-color); margin-top: 0.75rem; }
.app-progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--kms-red); transition: width 0.2s ease; }
.app-progress span { position: relative; display: block; text-align: center; line-height: 24px; font-size: 0.8rem; font-weight: 800; }

/* A label exactly as it prints: printer dots shown crisp, on white paper */
.app-printed-label {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  border: 2px solid var(--border-color);
  border-radius: 6px;
}
.app-print-preview { margin: 0.5rem 0; }
.app-copies { margin-top: 0.25rem; }
.app-copies .app-radio { margin: 0; }
.app-copies-input { width: 4.2rem; margin: 0; text-align: center; padding: 0.35rem; font-weight: 800; }
.app-print-preview .app-printed-label, .app-label-preview .app-printed-label { width: 260px; }

.app-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.75rem; }
.app-template-preview { display: flex; justify-content: center; align-items: center; min-height: 90px; margin-bottom: 0.6rem; }
.app-template-preview .app-printed-label { width: 100%; max-width: 220px; }

/* Designer: the label preview with draggable element outlines on top */
.app-designer-stage { position: relative; margin: 0.5rem auto; touch-action: none; }
.app-designer-stage .app-printed-label { border-radius: 0; border: 1px solid var(--border-color); box-sizing: content-box; }
.app-designer-overlay { position: absolute; inset: 0; }
.app-el-box { position: absolute; outline: 1px dashed rgba(227, 21, 21, 0.55); cursor: move; }
.app-el-box.selected { outline: 2px solid var(--kms-red); background: rgba(227, 21, 21, 0.08); }
.app-el-handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 16px;
  height: 16px;
  background: var(--kms-red);
  border: 2px solid var(--kms-white);
  border-radius: 4px;
  cursor: nwse-resize;
}
.app-add-row { font-size: 0.8rem; font-weight: 800; color: var(--text-sub); }
.app-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: -0.2rem 0 0.6rem 0; }
.app-chip {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
}

/* Two-or-more-way choice buttons (scan mode, sale views, payment methods) */
.app-segment { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.app-segment .app-btn { flex: 1; padding: 0.65rem 0.5rem; font-size: 0.85rem; }
.app-pay-methods { flex-wrap: wrap; }
.app-pay-methods .app-btn { flex: 1 1 40%; }

/* In-tab scanner */
.app-scan-view { width: 100%; max-width: 360px; margin: 0 auto 0.6rem auto; border-radius: 14px; overflow: hidden; border: 3px solid var(--kms-black); background: #000; }
.app-scan-manual { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.app-scan-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.app-scan-tools .app-btn { flex: 1 1 auto; }
.app-scan-manual .app-input { margin: 0; }
.app-last-scan { margin-top: 0.75rem; padding: 0.65rem 0.8rem; border-radius: 12px; background: var(--surface); border: 2px solid var(--kms-red); font-size: 0.85rem; line-height: 1.5; }
.app-cond-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 0.5rem; }
.app-cond-choice { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0.6rem 0.4rem; }
.app-cond-choice strong { font-size: 1.05rem; }
.app-cond-choice span { font-size: 0.7rem; font-weight: 600; color: var(--text-sub); }

/* Gift vouchers: the Inventory tab's summary (a button to the page), the page's total, used ones dimmed */
.app-voucher-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
}
.app-voucher-summary .app-card-title { margin: 0; }
.app-voucher-summary .app-stats { flex: 1; margin: 0; }
.app-voucher-summary .app-stats strong { color: var(--kms-red); font-size: 1.1rem; }
.app-voucher-total { display: flex; align-items: baseline; gap: 0.6rem; }
.app-voucher-total strong { font-size: 1.8rem; font-weight: 900; color: var(--kms-red); }
.app-voucher-total span { font-size: 0.85rem; font-weight: 700; color: var(--text-sub); }
.app-voucher-used { opacity: 0.6; }

/* Sales */
.app-total-row { display: flex; justify-content: space-between; align-items: center; padding-top: 0.75rem; font-size: 1.1rem; font-weight: 900; }
.app-total-row strong { color: var(--kms-red); font-size: 1.35rem; }
.app-total-sub { padding-top: 0.35rem; font-size: 0.9rem; font-weight: 700; color: var(--text-sub); }
.app-total-sub strong { font-size: 1.05rem; color: var(--text-main); }
.app-optional { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-sub); }
.app-chip.active { background: var(--kms-red); border-color: var(--kms-red); color: var(--kms-white); }
.app-chips[data-presets] .app-chip { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
.app-chips[data-donation-chips] .app-chip { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
.app-sale-item { flex-wrap: wrap; cursor: default; }
.app-price-edit { display: flex; align-items: center; gap: 2px; font-weight: 800; }
.app-price-edit .app-input { width: 5.2rem; margin: 0; padding: 0.35rem 0.4rem; text-align: right; }
/* Sale line extras: customer offer, consignment commission */
.app-item-actions { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin-top: 0.1rem; }
.app-sale-item .app-row-meta, .app-sale-item .app-badge { white-space: normal; }
.app-item-actions .app-chip { padding: 0.3rem 0.7rem; }
.app-void-commission { margin: 0; font-size: 0.75rem; }
.app-offer-line { color: var(--kms-red); font-weight: 700; }
/* Split payment rows */
.app-split-rows { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.5rem; }
.app-split-row { display: flex; align-items: center; gap: 0.4rem; }
.app-split-row select.app-input { flex: 1 1 auto; min-width: 0; margin: 0; }
/* Taking a payment: Charge on Square / Venmo and Zelle QR codes (lib/payments.js) */
.app-take-btn { width: 100%; margin: 0.25rem 0 0.4rem; }
.app-chip-done { cursor: default; border-color: #2e9d57; color: #2e9d57; white-space: nowrap; }
.app-paid-line { color: #2e9d57; font-weight: 700; }
.app-pay-qr { text-align: center; }
.app-pay-qr-amount { font-size: 2.2rem; font-weight: 900; margin-bottom: 0.4rem; }
.app-pay-qr-code { background: #fff; border-radius: 12px; padding: 8px; display: inline-block; width: min(280px, 100%); }
.app-pay-qr-code canvas, .app-pay-qr-code img { display: block; width: 100%; height: auto; }
.app-pay-qr-to { font-size: 1rem; margin: 0.6rem 0 0.2rem; }
.app-pay-qr-staff { font-style: italic; }
.app-break { overflow-wrap: anywhere; }
.app-pay-upload { display: flex; align-items: center; gap: 0.6rem; margin: 0.3rem 0 0.5rem; }
.app-pay-upload-thumb { width: 72px; height: 72px; background: #fff; border-radius: 8px; padding: 4px; flex: none; }
.app-pay-upload-thumb canvas, .app-pay-upload-thumb img { width: 100%; height: 100%; object-fit: contain; }
/* The Staff Tools button's count (new price alerts and other counts) */
.app-tools-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--kms-black);
  color: var(--kms-white);
  border: 2px solid var(--kms-white);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
}
.app-alert-arrow { font-size: 1.1rem; width: 1.4rem; text-align: center; }
.app-alert.up .app-alert-arrow, .app-alert.up .app-alert-change { color: #22c55e; }
.app-alert.down .app-alert-arrow, .app-alert.down .app-alert-change { color: var(--kms-red); }
.app-alert-change { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.75rem; font-weight: 700; }
.app-alert-change strong { font-size: 1rem; }
/* Phone width: wrap instead of cutting off prices and names */
.app-alert .app-row-meta, .app-sale-item .app-row-title { white-space: normal; }

.app-bulk-qty { margin-top: 0; }
.app-bulk-chips { margin: 0.5rem 0; }
.app-bulk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.app-bulk-grid .btn { padding: 0.8rem 0.25rem; font-size: 1rem; }
.app-balance { font-weight: 800; color: var(--text-main); font-size: 0.9rem; }
.app-photos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.app-photo { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid var(--border-color); }
.app-photo img { width: 100%; height: 100%; object-fit: cover; }
.app-photo-remove { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0, 0, 0, 0.7); color: #fff; font-weight: 800; cursor: pointer; }
.app-photo-full { width: 100%; border-radius: 10px; border: 2px solid var(--border-color); }
textarea.app-input { resize: vertical; font-family: inherit; }

.app-font-sample { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-thumb-image { display: flex; align-items: center; justify-content: center; }
.app-thumb-image img { max-width: 48px; max-height: 48px; }

@media (min-width: 760px) {
  .app-modal-overlay { align-items: center; padding: 2rem; }
  .app-modal { border-bottom: 3px solid var(--border-color); border-radius: 22px; }
  .app-panel-body { padding: 1.5rem 2rem; }
}

/* ---------- Sync: offline overlaps and status ---------- */
.app-overlap-card { border-color: var(--kms-red); }
.app-overlap-card .app-list-row { flex-wrap: wrap; cursor: default; }
.app-overlap-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; width: 100%; }
.app-overlap-actions .app-btn { flex: 1; }
.app-sale-flag { color: var(--kms-red); font-weight: 800; }
.app-sync-chip { position: relative; display: inline-block; margin-left: 0.4rem; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.25); font-size: 0.68rem; letter-spacing: 0.04em; cursor: pointer; }
/* A finger-sized tap area around the small chip (it opens Settings → Phone sync) */
.app-sync-chip::after { content: ''; position: absolute; inset: -12px -6px; }
.app-sync-chip.app-sync-chip-warn { background: #b45309; color: #fff; }

/* ---------- Offline prices note (price-cache.js) ---------- */
.app-prices-note {
  position: fixed;
  left: 50%;
  bottom: 5.4rem;
  transform: translateX(-50%);
  z-index: 140;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--kms-black);
  color: var(--kms-white);
  border: 2px solid var(--kms-red);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- Custom items (Sales → Other items) ---------- */
.app-saved-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; margin-bottom: 0.6rem; }
.app-saved-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0.6rem 0.7rem;
  font-family: inherit;
  text-align: left;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
}
.app-saved-item strong { font-size: 0.85rem; line-height: 1.2; }
.app-saved-item span { font-size: 0.8rem; font-weight: 800; color: var(--kms-red); }
.app-custom-btn { flex: 1; }

/* ---------- Staff ---------- */
.app-staff-bar { margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.app-staff-bar label { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 0.9rem; flex: 1; min-width: 0; }
.app-staff-manage { flex: 0 0 auto; white-space: nowrap; padding: 0.6rem 0.75rem; }
.app-staff-bar select { margin: 0; flex: 1; }
.app-staff-row { cursor: default; }
.app-staff-row .app-btn { flex: 0 0 auto; }

/* ---------- Add Cards ---------- */
.app-steps { margin: 0 0 0.75rem 0; padding-left: 1.25rem; font-size: 0.82rem; line-height: 1.5; color: var(--text-main); }
.app-steps li { margin-bottom: 0.3rem; }
.app-steps a, .app-last-scan a { color: var(--kms-red); font-weight: 700; }
.app-plan-summary { margin: 0 0 0.6rem 0; padding-left: 1.1rem; font-size: 0.85rem; line-height: 1.6; }
.app-plan-list { max-height: 260px; overflow-y: auto; margin-bottom: 0.6rem; border: 1px solid var(--line-soft); border-radius: 10px; padding: 0 0.5rem; }
.app-plan-list .app-list-row { cursor: default; }
.app-progress-log { margin-top: 0.6rem; font-size: 0.85rem; line-height: 1.6; }
a.app-btn { text-decoration: none; display: inline-block; }
.kms-app .app-panel .btn:disabled, .kms-app .app-modal .btn:disabled { opacity: 0.45; cursor: default; }

/* ---------- Profile switcher (tap the logo under the header) ---------- */
.app-profile-logo { cursor: pointer; }
.app-profile-list { display: flex; flex-direction: column; gap: 0.6rem; }
.app-profile-current { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.app-profile-current img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #fff; flex: 0 0 auto; }
.app-profile-current .app-hint { margin: 0.15rem 0 0 0; }
.app-profile-choice {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem;
  font-family: inherit;
  text-align: left;
  border-radius: 14px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
}
.app-profile-choice.active { border-color: var(--kms-red); box-shadow: 0 0 0 2px var(--kms-red) inset; }
.app-profile-choice img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #fff; flex: 0 0 auto; }
.app-profile-choice span { display: flex; flex-direction: column; gap: 2px; }
.app-profile-choice strong { font-size: 0.95rem; }
.app-profile-choice em { font-style: normal; font-size: 0.75rem; color: var(--text-sub); font-weight: 600; }

/* The price page's "Browse Our Stock" lists the KMS shop's stock only */
:root[data-profile="gg"] #browseStockBtn { display: none; }

/* ---------- Demo build (demo-boot.js, lib/demo-shop.js) ----------
   Its colors come from demo-boot.js. Not the KMS shop: no KMS stock list, no condition price editor. */
html.kms-demo #browseStockBtn,
html.kms-demo .app-cond-prices,
html.kms-demo [data-page="add-cards"],
html.kms-demo [data-page="condition-prices"] { display: none; }
.app-demo-logo { display: flex; justify-content: center; margin: 0.25rem 0 0.75rem; }
.app-demo-logo img {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--border-color); background: #fff;
}
.app-demo-swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.25rem 0 0.4rem; }
.app-demo-swatch {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--border-color);
  cursor: pointer; padding: 0; position: relative;
}
.app-demo-swatch.active { outline: 3px solid var(--text-main); outline-offset: 2px; }
.app-demo-custom {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--surface); color: var(--text-main); font-weight: 800; font-size: 1.3rem;
}
.app-demo-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- GG Crafts & Collectibles profile ----------
   Colors from the GG logo: blush pink, black script, white. Dark mode is still the default. */
:root[data-profile="gg"] {
  --kms-red: #c25a78;        /* rose accent (buttons, tabs, badges) */
  --kms-red-dark: #9e4560;
  --kms-black: #1d1d1f;
  --gg-blush: #fde2e1;
  --bg-page: #1b1d22;
  --bg-card: #24272d;
  --surface: #2c3037;
  --border-color: #3d424b;
  --line-soft: #32363e;
  --card-shadow: #0f1013;
  --text-main: #f8eeee;
  --text-sub: #b9abad;
  --band-bg: #121316;
  --band-border: #3d424b;
  --btn-alt-bg: #fde2e1;
  --btn-alt-fg: #1d1d1f;
  --error-color: #ff8a9e;
  --logo-ring: #24272d;
}
:root[data-profile="gg"][data-theme="light"] {
  --bg-page: #fdf4f3;
  --bg-card: #ffffff;
  --surface: #ffffff;
  --border-color: #e6c9cb;
  --line-soft: #f3e4e4;
  --card-shadow: #f2d2d4;
  --text-main: #1d1d1f;
  --text-sub: #7a6669;
  --band-bg: #1d1d1f;
  --band-border: #1d1d1f;
  --btn-alt-bg: #1d1d1f;
  --btn-alt-fg: #ffffff;
  --btn-outline-bg: #ffffff;
  --error-color: #b3261e;
  --logo-ring: #ffffff;
}
/* Blush header with black lettering, in both modes */
:root[data-profile="gg"] .brand {
  background: var(--gg-blush);
  color: var(--kms-black);
  border-bottom: 4px solid var(--kms-black);
}
:root[data-profile="gg"] .brand-name { letter-spacing: 0.12em; font-weight: 800; }
:root[data-profile="gg"] .brand-tag { letter-spacing: 0.3em; }
:root[data-profile="gg"] .brand-logo { background: var(--gg-blush); border-width: 4px; }
:root[data-profile="gg"] .app-panel-header {
  background: var(--gg-blush);
  color: var(--kms-black);
  border-bottom-width: 4px;
}
:root[data-profile="gg"] .app-panel-header .close-btn { color: var(--kms-black); }
:root[data-profile="gg"] .app-list-row.selected { background: rgba(194, 90, 120, 0.12); }

/* ---------- Game: Who's That Pokémon? ---------- */
.app-wtp-stage {
  position: relative;
  max-width: 420px;
  margin: 0 auto 0.75rem auto;
  aspect-ratio: 1 / 1.08;
  border-radius: 18px;
  overflow: hidden;
  border: 4px solid var(--kms-black);
  /* A calm blue, the same for every shop profile (owner's choice) */
  background: radial-gradient(circle at 50% 48%, #8fd0f5 0%, #4aa3df 38%, #2c6fb7 72%, #1f4f8f 100%);
  user-select: none;
  -webkit-user-select: none;
}
.app-wtp-title {
  position: absolute;
  top: 0.6rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 900;
  font-style: italic;
  color: #ffd400;
  -webkit-text-stroke: 1.5px #1d3f8f;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #1d3f8f;
  letter-spacing: 0.02em;
  z-index: 2;
}
.app-wtp-art {
  position: absolute;
  inset: 13% 9% 20% 9%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.app-wtp-art img {
  max-width: 100%;
  max-height: 100%;
  /* Black silhouette with a soft, slowly breathing white glow */
  filter: brightness(0) drop-shadow(0 0 4px #fff) drop-shadow(0 0 14px rgba(255, 255, 255, 0.85));
  animation: app-wtp-glow 3s ease-in-out infinite;
  transition: filter 0.7s ease-out;
  pointer-events: none;
}
@keyframes app-wtp-glow {
  50% { filter: brightness(0) drop-shadow(0 0 6px #fff) drop-shadow(0 0 24px rgba(255, 255, 255, 0.95)); }
}
.app-wtp-stage.revealed .app-wtp-art img {
  filter: brightness(1) drop-shadow(0 0 4px #fff) drop-shadow(0 0 16px rgba(255, 255, 255, 0.7));
  animation: app-wtp-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes app-wtp-pop { 0% { transform: scale(0.8); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.app-wtp-wait { color: #fff; font-weight: 800; text-align: center; padding: 1rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.app-wtp-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3; }
.app-wtp-stage.revealed .app-wtp-flash { animation: app-wtp-flash 0.55s ease-out; }
@keyframes app-wtp-flash { 0% { opacity: 0; } 15% { opacity: 0.95; } 100% { opacity: 0; } }
.app-wtp-name {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 3%;
  text-align: center;
  z-index: 2;
  opacity: 0;
  transform: translateY(30px);
}
.app-wtp-stage.revealed .app-wtp-name { opacity: 1; transform: none; transition: opacity 0.4s 0.25s, transform 0.5s 0.25s cubic-bezier(0.2, 1.4, 0.4, 1); }
.app-wtp-num { display: inline-block; font-weight: 900; font-size: 0.85rem; color: #fff; background: rgba(0, 0, 0, 0.45); border-radius: 999px; padding: 0.1rem 0.6rem; }
.app-wtp-poke {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.1;
  color: #ffd400;
  -webkit-text-stroke: 1.5px #1d3f8f;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #1d3f8f;
}
.app-wtp-types { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }
.app-wtp-type-badge, .app-wtp-region {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--type);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}
.app-wtp-region { background: rgba(0, 0, 0, 0.45); }
.app-wtp-go { display: block; width: 100%; max-width: 420px; margin: 0 auto; font-size: 1.15rem; }
.app-wtp-filters { max-width: 420px; margin: 1rem auto 0 auto; }
.app-wtp-pool { font-weight: 600; color: var(--text-sub); }
.app-wtp-group { margin-top: 0.6rem; }
.app-wtp-group .app-chips { margin: 0.3rem 0 0.5rem 0; }
.app-wtp-group .app-chip { font-size: 0.8rem; padding: 0.35rem 0.7rem; opacity: 0.55; }
.app-wtp-group .app-chip.active { opacity: 1; }
.app-wtp-group .app-wtp-type.active { background: var(--type); border-color: var(--type); color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .app-wtp-art img, .app-wtp-stage.revealed .app-wtp-art img, .app-wtp-stage.revealed .app-wtp-flash { animation: none; }
}

/* ---------- iPhone: room for the notch / Dynamic Island and the home bar ----------
   profile-boot.js marks html.kms-ios and adds viewport-fit=cover, so the page fills the whole
   screen and env(safe-area-inset-*) says how much of it the phone's own bars cover. */
html.kms-ios .brand { padding-top: calc(1.25rem + env(safe-area-inset-top)); }
html.kms-ios .theme-toggle { top: calc(0.9rem + env(safe-area-inset-top)); }
html.kms-ios .cart-bar { padding-bottom: calc(0.85rem + env(safe-area-inset-bottom)); }
html.kms-ios body { padding-bottom: calc(7.5rem + env(safe-area-inset-bottom)); }
html.kms-ios .drawer { padding-bottom: env(safe-area-inset-bottom); }
html.kms-ios .app-panel-header { padding-top: calc(1rem + env(safe-area-inset-top)); }
html.kms-ios .app-panel-body { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
html.kms-ios .app-modal-body { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
html.kms-ios .app-toast { bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
html.kms-ios .app-print-bar { bottom: calc(1rem + env(safe-area-inset-bottom)); }
html.kms-ios .app-prices-note { bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
@media (min-width: 760px) {
  html.kms-ios .brand { padding-top: calc(1.75rem + env(safe-area-inset-top)); }
  html.kms-ios .theme-toggle { top: calc(1.25rem + env(safe-area-inset-top)); }
  html.kms-ios .cart-bar { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  html.kms-ios body { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
}
