/* Apple-like product design: system type, airy surfaces, soft depth, black CTAs */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-secondary: #fbfbfd;
  --separator: rgba(0, 0, 0, 0.08);
  --separator-strong: rgba(0, 0, 0, 0.12);
  --label: #1d1d1f;
  --secondary-label: #6e6e73;
  --tertiary-label: #86868b;
  --accent: #1d1d1f;
  --accent-hover: #000000;
  --accent-press: #1d1d1f;
  --accent-soft: rgba(0, 0, 0, 0.06);
  --green: #30d158;
  --green-text: #248a3d;
  --green-soft: rgba(48, 209, 88, 0.12);
  --red: #ff3b30;
  --red-text: #d70015;
  --red-soft: rgba(255, 59, 48, 0.1);
  --orange: #ff9f0a;
  --orange-text: #b25000;
  --orange-soft: rgba(255, 159, 10, 0.14);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-secondary: rgba(120, 120, 128, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 980px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47059;
  letter-spacing: -0.016em;
  color: var(--label);
  background: var(--bg);
}

.app {
  width: min(1080px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--secondary-label);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--label);
}

.subtitle {
  margin: 0.55rem 0 0;
  max-width: 28rem;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.022em;
  color: var(--secondary-label);
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.pill {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 7.5rem;
  max-width: 14rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--separator);
}

.pill-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--tertiary-label);
}

.pill-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--label);
  word-break: break-all;
  line-height: 1.25;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--separator);
  padding: 1.35rem 1.4rem 1.45rem;
  margin-bottom: 1rem;
}

.card-header {
  margin-bottom: 1rem;
}

.card-header.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.2;
}

.card-header p {
  margin: 0.25rem 0 0;
  font-size: 14px;
  color: var(--secondary-label);
  letter-spacing: -0.01em;
}

/* GunStreamer account (dealer) */
.gs-trust-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--green-soft) 80%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--green-text) 25%, var(--separator));
  color: var(--label);
  font-size: 13px;
  line-height: 1.4;
}

.gs-cred-grid {
  margin-bottom: 0.5rem;
}

.gs-account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gs-account-summary-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.gs-account-summary-text strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--green-text, var(--label));
}

.gs-summary-detail {
  font-size: 13px;
  color: var(--secondary-label, var(--tertiary-label));
  line-height: 1.35;
}

.gs-account-card.is-collapsed {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.gs-account-card.is-collapsed .gs-account-body {
  display: none;
}

.gs-account-body[hidden],
.gs-account-summary[hidden] {
  display: none !important;
}

/* Scan */
.scan-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#upc-input {
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  color: var(--label);
  font: 500 16px/1.4 var(--mono);
  letter-spacing: -0.01em;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

#upc-input::placeholder {
  color: var(--tertiary-label);
  font-weight: 400;
  font-family: var(--font);
}

#upc-input:hover {
  background: var(--fill);
}

#upc-input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

.scan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.batch-meta {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--secondary-label);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--fill-secondary);
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
}

.store-select {
  height: 32px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--fill-secondary);
  color: var(--label);
  padding: 0 0.85rem;
  font: 500 13px/1 var(--font);
  max-width: 14rem;
}

.store-select:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

.status-line {
  min-height: 1.25em;
  margin: 0.85rem 0 0;
  font-size: 13px;
  color: var(--secondary-label);
}

.status-line.is-error {
  color: var(--red-text);
}

.status-line.is-ok {
  color: var(--green-text);
}

/* Buttons */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 44px;
  padding: 0 1.15rem;
  border: none;
  border-radius: var(--radius-pill);
  font: 500 14px/1 var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    transform 0.1s var(--ease), opacity 0.15s var(--ease);
  white-space: nowrap;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-press);
}

.btn-secondary {
  background: var(--fill);
  color: var(--label);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(120, 120, 128, 0.18);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  height: 44px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
}

.btn-danger-quiet {
  background: transparent;
  color: var(--red-text);
}

.btn-danger-quiet:hover:not(:disabled) {
  background: var(--red-soft);
}

.btn-tiny {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 13px;
  border-radius: var(--radius-pill);
}

/* Metrics */
.metrics {
  display: flex;
  gap: 0.45rem;
}

.metric {
  min-width: 4.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--fill-secondary);
  text-align: center;
}

.metric span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--tertiary-label);
  letter-spacing: -0.01em;
}

.metric strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--label);
}

.metric-ok strong {
  color: var(--green-text);
}

.metric-bad strong {
  color: var(--red-text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Mobile card queue (hidden on desktop) */
.queue-mobile {
  display: none;
}

.queue-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.queue-card-item {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.9rem;
  box-shadow: var(--shadow-sm);
}

.queue-card-item.is-invalid {
  background: color-mix(in srgb, var(--red-soft) 45%, var(--surface));
  border-color: color-mix(in srgb, var(--red) 22%, var(--separator));
}

.queue-card-item.is-selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.qci-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.qci-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--fill-secondary);
}

.qci-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qci-thumb-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 10px;
  font-weight: 600;
  color: var(--tertiary-label);
}

.qci-main {
  min-width: 0;
  flex: 1;
}

.qci-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  word-break: break-word;
}

.qci-meta {
  margin: 0.25rem 0 0;
  font-size: 13px;
  color: var(--secondary-label);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  font-variant-numeric: tabular-nums;
}

.qci-chips {
  margin-top: 0.4rem;
}

.qci-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--separator);
}

.qci-facts dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--tertiary-label);
}

.qci-facts dd {
  margin: 0.1rem 0 0;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.qci-missing {
  margin: 0.55rem 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--red-text);
  word-break: break-word;
}

.qci-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.qci-actions .btn {
  flex: 1;
  height: 44px;
}

/* Table */
.table-shell {
  border-radius: var(--radius-md);
  border: 1px solid var(--separator);
  background: var(--surface-secondary);
  overflow: auto;
  max-height: min(58vh, 620px);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(251, 251, 253, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--separator);
  padding: 0.7rem 0.65rem;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--secondary-label);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem;
  border-bottom: 1px solid var(--separator);
  vertical-align: middle;
  color: var(--label);
  background: var(--surface);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr.row-invalid td {
  background: color-mix(in srgb, var(--red-soft) 55%, var(--surface));
}

.data-table tr.selected td {
  background: var(--accent-soft);
}

.data-table tr:hover td {
  background: color-mix(in srgb, var(--fill-secondary) 80%, var(--surface));
}

.data-table tr.row-invalid:hover td {
  background: color-mix(in srgb, var(--red-soft) 70%, var(--surface));
}

.data-table tr.selected:hover td {
  background: color-mix(in srgb, var(--accent-soft) 85%, var(--surface));
}

.col-thumb {
  width: 52px;
}

.thumb img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--fill-secondary);
  display: block;
}

.col-acts {
  white-space: nowrap;
  text-align: right;
}

.missing-list {
  color: var(--red-text);
  font-size: 12px;
  max-width: 9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  margin: 0.1rem 0.15rem 0.1rem 0;
  padding: 0.18rem 0.5rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: var(--radius-pill);
  border: none;
}

.chip-err {
  color: var(--red-text);
  background: var(--red-soft);
}

.chip-warn {
  color: var(--orange-text);
  background: var(--orange-soft);
}

.chip-ok {
  color: var(--green-text);
  background: var(--green-soft);
}

.empty-state {
  display: none;
  padding: 3.25rem 1.5rem;
  text-align: center;
  color: var(--secondary-label);
}

.empty-title {
  margin: 0 0 0.35rem;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--label);
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

/* Editor */
.editor-card[hidden] {
  display: none !important;
}

#editor-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form-section {
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
  border: 1px solid var(--separator);
  padding: 1rem 1.05rem 1.1rem;
}

.form-section h3 {
  margin: 0 0 0.85rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--secondary-label);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.85rem 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-all {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .field.span-2 {
    grid-column: 1 / -1;
  }
}

.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary-label);
  letter-spacing: -0.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--separator-strong);
  color: var(--label);
  padding: 0.65rem 0.75rem;
  font: 400 15px/1.3 var(--font);
  letter-spacing: -0.016em;
  transition: box-shadow 0.15s var(--ease);
}

.field textarea {
  min-height: 5.5rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft), inset 0 0 0 1.5px var(--accent);
}

.editor-hint {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--orange-soft);
  color: var(--orange-text);
  font-size: 13px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--separator);
}

/* Photos */
.photo-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.photo-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.55rem;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--separator);
}

.photo-row .photo-preview {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--fill-secondary);
  display: block;
}

.photo-row .photo-preview.is-empty {
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--tertiary-label);
  letter-spacing: 0.02em;
}

.photo-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  margin: 0;
}

.photo-row label span {
  font-size: 11px;
  font-weight: 500;
  color: var(--secondary-label);
}

.photo-row input {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: 400 13px/1.2 var(--mono);
  background: var(--fill-secondary);
  color: var(--label);
  box-shadow: none;
}

.photo-row input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.photo-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--tertiary-label);
  font-variant-numeric: tabular-nums;
}

/* Footer */
.app-footer {
  margin-top: 1.25rem;
  padding: 0 0.25rem;
}

.help {
  color: var(--secondary-label);
  font-size: 13px;
}

.help summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent);
  list-style: none;
  user-select: none;
}

.help summary::-webkit-details-marker {
  display: none;
}

.help ul {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
  color: var(--secondary-label);
}

.help li {
  margin-bottom: 0.4rem;
}

.help code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--fill-secondary);
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  color: var(--label);
}

/* Settings sheet + dealer gate */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: flex-end;
}

.sheet-overlay.gate-overlay {
  z-index: 50;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
}

.sheet-overlay[hidden] {
  display: none !important;
}

.gate-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--separator);
  padding: 1.5rem 1.4rem 1.35rem;
}

.gate-card h2 {
  margin: 0.15rem 0 0.5rem;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.gate-card .field {
  margin-bottom: 0.75rem;
}

.gate-card select,
.gate-card input {
  width: 100%;
  border: none;
  border-radius: 10px;
  background: var(--fill-secondary);
  color: var(--label);
  padding: 0.7rem 0.8rem;
  font: 400 15px/1.3 var(--font);
}

.gate-card select:focus,
.gate-card input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

.gate-admin-hint {
  margin: 1.1rem 0 0;
  font-size: 13px;
  color: var(--tertiary-label);
  text-align: center;
}

.gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.gate-actions .btn {
  width: 100%;
  justify-content: center;
}

.btn-help-prominent {
  appearance: none;
  border: 2px solid var(--accent);
  background: var(--accent-soft, rgba(0, 122, 255, 0.12));
  color: var(--accent);
  font: 600 15px/1.2 var(--font);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  letter-spacing: -0.01em;
}

.btn-help-prominent:hover {
  background: var(--accent);
  color: #fff;
}

.gate-help-prompt {
  margin: 0.85rem 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--secondary-label, var(--label));
  text-align: center;
}

.footer-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

/* Dealer help panel */
.sheet-overlay.help-overlay {
  z-index: 60;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.help-panel {
  width: min(560px, 100%);
  max-height: min(92vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--separator);
  overflow: hidden;
}

.help-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.25rem 1.35rem 0.85rem;
  border-bottom: 1px solid var(--separator);
}

.help-panel-header h2 {
  margin: 0.1rem 0 0.35rem;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.help-lead {
  margin: 0;
  max-width: 36ch;
}

.help-panel-body {
  overflow: auto;
  padding: 1rem 1.35rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.help-step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--separator);
}

.help-step:last-child {
  border-bottom: none;
}

.help-step h3 {
  margin: 0 0 0.35rem;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.help-step p {
  margin: 0 0 0.45rem;
  font-size: 14px;
  line-height: 1.45;
  color: var(--secondary-label, var(--label));
}

.help-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: 700 14px/1 var(--font);
  flex-shrink: 0;
}

.help-step-tips .help-step-num {
  background: var(--fill-secondary);
  color: var(--label);
  border: 1px solid var(--separator);
}

.help-ol,
.help-ul {
  margin: 0.25rem 0 0.55rem;
  padding-left: 1.2rem;
  font-size: 14px;
  line-height: 1.45;
  color: var(--secondary-label, var(--label));
}

.help-ol li,
.help-ul li {
  margin-bottom: 0.3rem;
}

.help-note {
  font-size: 13px !important;
  color: var(--tertiary-label) !important;
  background: var(--fill-secondary);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.help-panel-footer {
  padding: 0.85rem 1.35rem 1.15rem;
  border-top: 1px solid var(--separator);
}

.help-panel-footer .btn {
  width: 100%;
  justify-content: center;
}

@media (max-width: 520px) {
  .help-panel {
    max-height: 96vh;
    border-radius: 16px;
  }

  .gate-card {
    width: min(420px, 100%);
  }
}

.linkish {
  appearance: none;
  border: none;
  background: none;
  color: var(--accent);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app.is-locked .card,
.app.is-locked .app-footer {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.sheet {
  width: min(480px, 100%);
  height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--separator);
}

.sheet-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.sheet-body {
  flex: 1;
  overflow: auto;
  padding: 1.15rem 1.25rem 2rem;
}

.sheet-lead {
  margin: 0 0 1rem;
  color: var(--secondary-label);
  font-size: 14px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-head h3 {
  margin: 0;
}

.field-hint {
  margin: 0.65rem 0 0;
  font-size: 12px;
  color: var(--tertiary-label);
}

.stores-editor {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.store-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--separator);
  background: var(--surface);
  padding: 0.85rem;
}

.store-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary-label);
}

@media (max-width: 720px) {
  .app {
    width: calc(100% - 1.25rem);
    padding: 1.15rem 0 calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .topbar h1 {
    font-size: 1.75rem;
  }

  .subtitle {
    font-size: 15px;
  }

  .topbar-right {
    align-items: stretch;
    width: 100%;
  }

  .status-pills {
    justify-content: flex-start;
  }

  .pill {
    min-width: calc(50% - 0.25rem);
    max-width: none;
    flex: 1 1 calc(50% - 0.25rem);
  }

  .card {
    padding: 1rem 0.95rem 1.05rem;
    border-radius: 14px;
  }

  .card-header.row-between {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .metrics {
    width: 100%;
  }

  .metric {
    flex: 1;
    min-width: 0;
  }

  /* Queue: cards on, table off */
  .queue-desktop {
    display: none !important;
  }

  .queue-mobile {
    display: flex !important;
  }

  .queue-toolbar {
    position: sticky;
    bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    z-index: 5;
    margin: 0.35rem 0 0.85rem;
    padding: 0.55rem;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border: 1px solid var(--separator);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
  }

  .queue-toolbar .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0.7rem;
    font-size: 13px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field.span-2,
  .field.span-all {
    grid-column: 1 / -1;
  }

  .photo-row {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .photo-row > button {
    grid-column: 1 / -1;
    height: 40px;
  }

  .sheet {
    width: 100%;
  }

  .editor-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--surface) 70%, transparent);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (min-width: 721px) {
  .queue-mobile {
    display: none !important;
  }

  .queue-desktop {
    display: block;
  }
}
