/* PDF Editor section styles — mobile-first, scoped to #tab-pdf.
   Brand: Ryder red #CE1126, light theme. No tracker styles touched. */

#tab-pdf { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }

.pe-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  padding: 16px;
  margin-bottom: 16px;
}

.pe-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1f1f1f;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pe-card h3 i { color: #CE1126; }

.pe-note {
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
  margin: 0 0 12px;
}

.pe-status {
  font-size: 14px;
  font-weight: 600;
  color: #1f1f1f;
  background: #FBECEE;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.pe-status:empty { display: none; }

/* Buttons and inputs: 16px text (no iOS auto-zoom), 44px+ targets */
.pe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1f1f1f;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.pe-btn:active { transform: scale(.98); }
.pe-btn:disabled { opacity: .45; cursor: not-allowed; }
.pe-btn-primary { background: #CE1126; border-color: #A90E1F; color: #fff; }
.pe-btn-dark { background: #1f1f1f; border-color: #000; color: #fff; }
.pe-btn-active { background: #FBECEE; border-color: #CE1126; color: #A90E1F; }

.pe-input, .pe-select {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #1f1f1f;
}

.pe-input-color {
  width: 100%;
  min-height: 44px;
  padding: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.pe-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin: 10px 0 4px;
}

.pe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 640px) {
  .pe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.pe-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Drop zone */
.pe-drop {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
}

.pe-drop.drag { border-color: #CE1126; background: #FBECEE; color: #A90E1F; }

.pe-fileinfo { font-size: 14px; color: #334155; margin-top: 10px; }

/* Viewer */
.pe-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.pe-toolbar .pe-pagebox { width: 64px; text-align: center; }

.pe-canvas-wrap {
  position: relative;
  overflow-x: auto;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  touch-action: pan-x pan-y;
}

.pe-canvas-box { position: relative; margin: 0 auto; line-height: 0; }

.pe-canvas-box canvas { display: block; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); }

.pe-overlay {
  position: absolute;
  inset: 0;
  line-height: normal;
  pointer-events: none;
}

.pe-item {
  position: absolute;
  box-sizing: border-box;
  cursor: grab;
  touch-action: none;
  overflow: hidden;
  pointer-events: auto;
}

.pe-item:active { cursor: grabbing; }

.pe-item-text { white-space: pre-wrap; word-break: break-word; line-height: 1.2; }

.pe-item-whiteout { background: #fff; border: 1px solid #e2e8f0; }

.pe-item-img { border: 1px dashed #94a3b8; }
.pe-item-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.pe-item-field {
  border: 2px dashed #CE1126;
  background: rgba(206,17,38,.07);
  color: #A90E1F;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  padding: 2px 6px;
  overflow: hidden;
  white-space: nowrap;
}

.pe-item-selected { outline: 3px solid #CE1126; outline-offset: 1px; }

/* Thumbnails */
.pe-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 2px 12px;
}

.pe-thumb {
  flex: 0 0 auto;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.pe-thumb.active { border-color: #CE1126; color: #A90E1F; }
.pe-thumb canvas { display: block; }

/* Signature pad */
.pe-sigpad {
  width: 100%;
  height: 150px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  touch-action: none;
  display: block;
}

/* Sticky bottom action bar inside the section */
.pe-stickybar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: rgba(255,255,255,.96);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 10px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}

.pe-stickybar .pe-btn { flex: 1; }

.pe-hidden { display: none !important; }

.pe-formrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

.pe-formrow:last-child { border-bottom: 0; }
.pe-formrow label { font-size: 14px; font-weight: 600; color: #334155; min-width: 140px; }
.pe-formrow .pe-input, .pe-formrow .pe-select { flex: 1; min-width: 180px; }
