* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f5f5f5;
}

header {
  background: #333;
  color: white;
  padding: 1rem;
  text-align: center;
}

header h1 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.form-header {
  background: white;
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-header label {
  display: block;
  margin-bottom: 1rem;
  font-weight: bold;
}

.form-header input {
  width: 50%;
  padding: 0.35rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 0.25rem;
}

.section {
  background: white;
  margin-bottom: 1rem;
  border-radius: 4px;
  overflow: hidden;
}

.section-header {
  background: #444;
  color: white;
  padding: 0.75rem 1rem;
  font-weight: bold;
  font-size: 1.1rem;
}

.section-content {
  padding: 1rem;
}

.checklist-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.checklist-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.checkbox-row input[type="checkbox"] {
  margin-right: 0.75rem;
  margin-top: 0.25rem;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.checkbox-row label {
  flex: 1;
  cursor: pointer;
  line-height: 1.4;
}

.comment-box {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
}

.inventory-section {
  background: white;
  margin-bottom: 1rem;
  border-radius: 4px;
  overflow: hidden;
}

.inventory-header {
  background: #444;
  color: white;
  padding: 0.75rem 1rem;
  font-weight: bold;
  font-size: 1.1rem;
}

.inventory-content {
  padding: 1rem;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.inventory-table th {
  background: #f0f0f0;
  padding: 0.5rem;
  text-align: left;
  border: 1px solid #ddd;
  font-weight: bold;
}

.inventory-table td {
  padding: 0.5rem;
  border: 1px solid #ddd;
}

.inv-name-label {
  font-weight: 500;
  padding: 0.5rem;
}

.inventory-table input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

.add-row-btn {
  padding: 0.5rem 1rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.delete-row-btn {
  padding: 0.25rem 0.5rem;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.signature-section {
  background: white;
  padding: 1rem;
  border-top: 2px solid #333;
  margin: 1rem 0;
}

.signature-button {
  width: 100%;
  padding: 1rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.signature-button:active {
  background: #0056b3;
}

.generate-button {
  width: 100%;
  padding: 1rem;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

.generate-button:active {
  background: #1e7e34;
}

.signature-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  padding: 1rem;
}

.signature-modal.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-content-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 400px;
}

.modal-header {
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.close-btn {
  background: #dc3545;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.signature-canvas-container {
  flex: 1;
  background: white;
  border-radius: 4px;
  margin-bottom: 1rem;
  position: relative;
  min-height: 200px;
  width: 100%;
  aspect-ratio: 16 / 9;
}

#signatureCanvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.modal-buttons button {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

.clear-btn {
  background: #6c757d;
  color: white;
}

.save-btn {
  background: #28a745;
  color: white;
}

.signature-status {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.25rem;
}

.signature-status.signed {
  color: #28a745;
  font-weight: bold;
}