.rs-widget {
  max-width: 760px;
  margin: 16px auto;
  padding: 18px;
  border: 1px solid #d9dfe7;
  border-radius: 10px;
  background: #f8fafc;
}

.rs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.rs-grid label span {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.rs-grid input {
  width: 100%;
}

.rs-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.rs-phase {
  background: #ffffff;
  border: 1px solid #d9dfe7;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.rs-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rs-step-index {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0e7490;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.rs-step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rs-step-text strong {
  line-height: 1.1;
}

.rs-step-text span {
  color: #475569;
  font-size: 13px;
}

.rs-phase.is-locked {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.rs-phase.is-locked .rs-step-index {
  background: #0f766e;
}

.rs-phase.is-locked .rs-step-head::after {
  content: attr(data-rs-lock-label);
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #0f766e;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 2px 8px;
}

.rs-phase.is-locked .rs-step-body,
.rs-phase.is-locked .rs-grid,
.rs-phase.is-locked .rs-upload-actions,
.rs-phase.is-locked .rs-remember,
.rs-phase.is-locked .rs-preview-wrap,
.rs-phase.is-locked .rs-status {
  pointer-events: none;
}

.rs-phase[data-rs-phase="2"],
.rs-phase[data-rs-phase="3"],
.rs-phase[data-rs-phase="4"] {
  opacity: 0;
  transform: translateY(10px);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease, max-height 280ms ease;
}

.rs-phase.is-visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 1600px;
  pointer-events: auto;
}

.rs-upload-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.rs-btn {
  background: #005a8d;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.rs-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.rs-submit {
  margin-top: 10px;
  background: #0f766e;
}

.rs-preview-wrap {
  margin-top: 10px;
}

.rs-preview {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #fff;
}

.rs-manual {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #f59e0b;
  background: #fffbeb;
  border-radius: 8px;
}

.rs-manual h4 {
  margin: 0 0 8px;
}

.rs-manual p {
  margin: 0 0 10px;
  font-size: 13px;
}

.rs-manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rs-manual-grid label span {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.rs-manual-grid input {
  width: 100%;
}

.rs-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef2ff;
  color: #1e293b;
}

.rs-status.is-success {
  background: #dcfce7;
  color: #14532d;
}

.rs-status.is-error {
  background: #fee2e2;
  color: #7f1d1d;
}

.rs-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.rs-result-message {
  margin: 0 0 10px;
  font-weight: 600;
}

.rs-result.is-success {
  border-color: #86efac;
  background: #dcfce7;
  color: #14532d;
}

.rs-result.is-error {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #7f1d1d;
}

.rs-restart {
  background: #1e40af;
}

.rs-restart:hover {
  background: #1d4ed8;
}

.rs-form {
  position: relative;
}

.rs-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 10px;
}

.rs-overlay[hidden] {
  display: none !important;
}

.rs-overlay-card {
  background: #ffffff;
  border: 1px solid #d9dfe7;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.rs-overlay-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rs-qr-snippet {
  max-width: 140px;
  max-height: 140px;
  border: 2px solid #0f766e;
  border-radius: 6px;
  display: block;
}

.rs-qr-snippet[hidden] {
  display: none !important;
}

.rs-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #cbd5e1;
  border-top-color: #0f766e;
  animation: rs-spin 1s linear infinite;
}

.rs-overlay-text {
  font-weight: 600;
  color: #0f172a;
}

@keyframes rs-spin {
  to {
    transform: rotate(360deg);
  }
}

.rs-hp {
  position: absolute;
  left: -99999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 860px) {
  .rs-grid {
    grid-template-columns: 1fr;
  }

  .rs-manual-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Inline field validation errors ─────────────────────────────────────── */
.rs-grid input.rs-field-error,
.rs-grid select.rs-field-error,
.rs-manual-grid input.rs-field-error,
.rs-manual-grid select.rs-field-error {
  border-color: #ef4444;
  outline-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.rs-field-error-msg {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #dc2626;
}

@media (prefers-reduced-motion: reduce) {
  .rs-phase[data-rs-phase="2"],
  .rs-phase[data-rs-phase="3"],
  .rs-phase[data-rs-phase="4"] {
    transition: none;
  }
}

/* ── Mark hint / blurred receipt examples ───────────────────────────────── */
.rs-mark-hint {
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed #f59e0b;
  background: #fffbeb;
  border-radius: 8px;
}

.rs-mark-hint-title {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 13px;
  color: #92400e;
}

.rs-mark-examples {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .rs-mark-examples {
    grid-template-columns: 1fr;
  }
}

.rs-mark-example-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rs-example-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-align: center;
}

.rs-receipt-blur-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #d9dfe7;
  background: #f1f5f9;
  aspect-ratio: 9 / 16;
}

.rs-receipt-blurred {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  filter: blur(5px);
  transform: scale(1.06); /* compensate blur edge */
}

.rs-mark-pin {
  position: absolute;
  left: 6%;
  right: 6%;
  border: 2.5px solid #ef4444;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.rs-mark-pin-label {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ── MARK field label ───────────────────────────────────────────────────── */
.rs-mark-label-wrap {
  grid-column: 1 / -1;
}

.rs-mark-label-wrap small {
  font-size: 11px;
  font-weight: 400;
  color: #64748b;
}

/* ── Remember me (hidden on mobile when cookies unsupported) ────────────── */
.rs-remember[hidden] {
  display: none !important;
}
